Or you can just buy a cable luber at your local bike shop for $7.00,and leave the cables on the bike.Can lube all your cables in like 5 mins.Except your speedo cable witch needs to be cleaned and then lubed with a good waterproof grease.
Well, using either of the suggested home methods does not require removing the cable from the bike , any more than the commercial cable lubers.
My experiance with the store bought ones is the spray can seems to allways back-fire some, messing up you and your bike. You also have to stand there holding the damn thing waiting for the oil to work it's way through....especialy if the cable is badly gunked up to start with.
The other methods are less messy, actually do a much better job, and require very little time invested...or money.
In the shop I worked we used solvent proof rubber gloves. Each finger had the tip nipped off so we could "lube" 5 cables at a time (if they were in fact removed from the bike) We actualy had two of these, one glove was only used with a solvent based oil like WD40 to clean the crap out of the cable, and the other glove was used for the lubricating oil.
After the "solvent" treatment was done, before removing the cable, we'd grab the "finger" it was attached to and stick the end of a rubber tipped air nozzle down inside it, carefully blowing the remaining solvent out before using the "oiling glove".
This method would make any cable feel like it was brand new, no matter how gummed up it was.