A cylinder uses pressurized fluid or air to create a linear force/motion as shown in Figure 4.1 A Cross Section of a Hydraulic Cylinder. In the figure a fluid is pumped into one side of the cylinder under pressure, causing that side of the cylinder to expand, and advancing the piston. The fluid on the other side of the piston must be allowed to escape freely - if the incompressible fluid was trapped the cylinder could not advance. The force the cylinder can exert is proportional to the cross sectional area of the cylinder.
Figure 4.1 A Cross Section of a Hydraulic Cylinder
Single acting cylinders apply force when extending and typically use a spring to retract the cylinder. Double acting cylinders apply force in both direction.
Figure 4.1 Schematic Symbols for Cylinders
Magnetic cylinders are often used that have a magnet on the piston head. When it moves to the limits of motion, reed switches will detect it.