Bicycles/Cable ends
These small closed cylinders of soft metal are crimped over the inner cable end to prevent fraying/unraveling of the cable. This is more important than it sounds at first,cables last longer and don't damage clothing as a fraying cable can. It may even stop a small but very annoying puncture wound on your calf. Sometimes these are provided with replacement cables - they are always fitted to new bikes.
Alternate methods
editSoldering
editA better solution is to use a soldering iron and some soft solder to the same end- simply heating the cable , "wicking" in some solder and then trimming for neatness. With this method there is no possibility of it going astray- as crimp on ends can and do.
Spoke Nipple
editA very cheap and effective solution is to use an old spoke nipple. The nipple is slid over the end of the cable and crimped on with a sturdy pair of pliers. Some pliers have a crimping area behind the pivot which works vey well.