Using !$ To Use Last Parameter

22nd July 2008 - 1 minute read time

Much 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 example.

  1. # cd ..
  2. # cd !$

In this example we are moving up a directory and then doing the same action again, the !$ is a short cut to get hold of the ... This is more useful when doing things with longer parameters like directory or file names. For example here we are creating a directory and then moving into that same directory.

  1. # mkdir /www/htdocs/directory/
  2. # cd !$

Add new comment

The content of this field is kept private and will not be shown publicly.