Use Alt+. To Print Out Last Parameter

27 June, 2008 | Unix/Linux

A handy trick when using a Unix/Linux system is to repeat the last parameter from the previous line. Lets say that you typed in the following line to move a file to another directory.

$ mv file.txt /usr/local/

To then move into that directory you can just type cd and Alt+. to copy in the last parameter used in the last line. This will put the following on the command line.

$ cd /usr/local/

You can press Alt+. multiple times to go back through your parameter history. Note that it only records the last parameter used for each line. So for the example above, if you pressed Alt+. twice you would get the last parameter of whatever command you executed before moving the file.

Comments

Pingback from Using !$ To Use Last Parameter | Talk In Code
Date: July 22, 2008, 8:15 am

[...] like using Alt+. to print out last parameter you can also use !$ to use the last parameter from the previous command. Here is a simple [...]

Write a comment