How can I move the objects in a single direction?
Press X Y or Z to constrain the transformation to a single axis.

You can also press &#8679; Shift X/Y/Z to constrain the transformation to two axes. For example, G+&#8679; ShiftZ will constrain the transformation to the X/Y plane.