Theory:

Construct a line segment of length \(2\) \(cm\) using ruler and compasses.
 
Webp.net-gifmaker.gif
 
Step 1: Draw a line \(l\). Mark a point \(A\) on a line \(l\).
 
output-onlinepngtools (13).png

Step 2: Place the compasses pointer on the zero mark of the ruler. Open it to place the pencil point up to the \(2\) \(cm\) mark.
 
output-onlinepngtools (19).png

Step 3: Please see that the opening of the compasses has not changed, place the pointer on \(A\) and swing an arc to cut the line \(l\) and then mark the point as \(B\).
 
output-onlinepngtools (20).png
 
\(AB\) is a line segment of the required length.
 
output-onlinepngtools (22).png