Allan & Steve are the chubby founders of LessEverything. This is their blog, hear them rant, praise, give advice and talk about Just Stuff, Less Accounting, Lovd by Less, More Honey, Less Memories, Code, Business, Design, Marketing
December 11th, 2007

Bash Tip

written by Steven Bristol

Try this:


> ls -al
drwxr-xr-x  23 steve  steve    782 Dec  9 00:27 .
drwxr-xr-x  39 steve  steve   1326 Dec 11 21:21 
drwxr-xr-x  11 steve  steve    374 Dec 11 18:16 .svn
.......
> !!
drwxr-xr-x  23 steve  steve    782 Dec  9 00:27 .
drwxr-xr-x  39 steve  steve   1326 Dec 11 21:21 
drwxr-xr-x  11 steve  steve    374 Dec 11 18:16 .svn
.......
> ls -al
drwxr-xr-x  23 steve  steve    782 Dec  9 00:27 .
drwxr-xr-x  39 steve  steve   1326 Dec 11 21:21 
drwxr-xr-x  11 steve  steve    374 Dec 11 18:16 .svn
.......
> ls !$
drwxr-xr-x  23 steve  steve    782 Dec  9 00:27 .
drwxr-xr-x  39 steve  steve   1326 Dec 11 21:21 
drwxr-xr-x  11 steve  steve    374 Dec 11 18:16 .svn
.......
So:
  1. !! reruns the last command (very useful if you forget to put sudo in front: > sudo !!).
  2. !$ gets the first param of the last command.

Leave a Reply