Ummm... which version of which CAD program?
In some CAD programs, the trim command is also the extend command. You just trim to a line or point beyond the end to extend and trim to a line or point along the line to trim.
In other cad programs extend is separated and you have to extend a line to a line or point and you can trim to a line or point.
Otherwise, trim can have multiple meanings and may automatically chamfer or apply a radius to intersecting lines. Another common trim command trims a line between two points and it will extend the line if it doesn't intersect. The opposite is also true with a trim command that removes a section between two points. A lot depends on how the CAD program is designed.
Having used a variety of CAD programs from Autocad 10 up through Autocad 2002 along with Cadkey, Qcad and various others, you really have to have which CAD program you are using. Various commands work different between different versions of the same program. Otherwise, the best I can do is a sort of generic answer that allows for most possibilities.
In use, trim and extend are usually fairly simple.
Shadow Wolf