Modern outer-cables have plastic linings so lubrication is not necessary for operation. Keeping the bike cables lubricated is mostly to keep water from getting into the tiny spaces between the inner and outer-cables.
Use synthetic lubricants not mineral oil or grease. Mineral products may degrade the plastic lining of the outer brake cable or gear cable.
Teflon-coated inner-cables don’t need lubrication.
Introduce a small amount of synthetic grease in the lever-end of any outer brake cable brake runs. Threading the inner brake cable in will force the grease through the pipe. Wipe off any excess as the inner-wire emerges.
Dismount the brake cable or gear cable
Apply a drop of liquid lubrication at the point where the inner-cable emerges from the outer-cable and slide the outer-cable back and forth to drag the lube into the outer-cable. Wipe off excess.