A cam shaft or any shaft needs to be controlled. Obviously it needs controlled from bending/flexing. This is done by providing bearings along the shaft that are evenly spaced apart and that are close enough together that the shaft will not deflect. The not so obvious control is from moving back and forth along its axis. A crank shaft uses a thrust bearing to control this motion.

Image Source :http://www.chevydiy.com/big-inch-chevy-small-block-building-blueprinting-cheat-sheet/
There are two basic cam setups, overhead valve (with the cam in the block) and overhead cam.
Overhead cam engines are the easiest to understand. The cam is held to the head with bearing caps. One of these caps is used as the trust bearing. The overhead cam setups don't use bearing inserts, instead the head surface is used as a bearing directly. This applies to almost every overhead cam engine, there are exceptions.
Overhead valve is where it gets confusing. There are two distinct cases, roller lifters and non roller lifters or just regular lifters. The regular lifter setup came first so lets start there. The camshaft lobes are ground in such a way that there is a slope to the lobes. This slope is used to spin the lifter but it has a side effect. The effect is that the slope slides the cam backwards in the block. After the cam is installed into the block a thrust plate captures the cam. This plate keeps the cam from sliding out of the block and provides a bearing surface. The back of the cam gear then has a bearing or bushing. The final result is that the cam is forced back which forces the back of the cam gear against the thrust plate. This action hods the cam from walking around.

Image Sourcehttp://garage.grumpysperformance.com/index.php?threads/cast-roller-cams-and-high-spring-pressures-don-t-work-well.1489/ :

Image Source :http://www.chevydiy.com/build-big-inch-chevy-small-block-engines-camshafts-guide/
In a roller cam the lobe profile is flat instead of sloped. Because of this the cam looses the action of being slid back. This necessitates adding a bearing at the end of the cam to keep it from sliding forward. Similar to the regular lifter cam the back of cam gear has a bushing or bearing to control the back wards movement. If converting a regular lifter cam to a roller cam the timing cover is commonly replaced with a special one.

Image Source :http://www.chevydiy.com/big-inch-chevy-small-block-building-blueprinting-cheat-sheet/