Matt Seymour

In bash and zsh you can use an in command shortcut to use the last parameter of the previous command as an argument for the next command.

For example say you view the contents of a file using cat:

cat /path/to/file/name.txt

Now you realise you want edit the file in some way. Instead of typing the command: vim /path/to/file/name.txt you can instead use:

vim !$

Or even the following example:

> cat /path/to/file/name.txt
> mv !$ /new/file/path.txt

Not only does this save you some valuable keystrokes, it is also quicker and less error prone.