Use Alt+. To Print Out Last Parameter

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.

Add new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
1 + 1 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.