Working on the command line shell typically involves using the same argument of the previous command. In bash there is a trick to save you those boring keystrokes. When you use "
!$" (called bang dollar-sign ) in a command, bash will expand it to the last argument of the previous command. A simple example to clarify:
$> file /etc/fstab /etc/fstab: ASCII text $> ls -l !$ ls -l /etc/fstab -rw-r--r-- 1 root root 894 2005-08-03 15:12 /etc/fstab
As you see bash replaced the "
!$" of the second command with "
/etc/fstab", the last argument of the first command. First bash shows the expanded code (first line of the output) and then executes the command.
For more handy bash tricks like these you should visit the resource where I found this "bang dollar-sign trick" : advancing in the bash shell.