With the Trim/extend function from the right mouse button menu it is possible to trim or extend lines. To use this feature:
Two examples are shown below, and in the animation below:
Note that using this option through the command line, the following command should be used: snaplinear. It takes two arguments: first the endpoint of the line to be trimmed, and secondly the line it should trim/extend to, for example:
Also see the command reference from the Help menu for further information.