Shell - Saving keystrokes by using !$

You are not authorized to post comments.
Tutorial Icon: 

This is a quick tip on using your shell more efficiently by using !$. How !$ works is it takes the last argument you supplied in your last command and allows you to repeat it.

Here is a good example of how to use it:

cp source.tar.gz /usr/local/src

Here I am just copying a source.tar.gz file into /usr/local/src so I can begin to compile. To save me time of typing out

cd /usr/local/src

I can simply issue:

cd !$

This will take me into /usr/local/src without me actually typing out the full path. This can save you valuable time in typing long path names.