If you type !<command> it repeats the last time you used said command (with the same arguements you used before).
So, for instance, if I type ps a followed by a !ps I will get the ps a output twice. This is useful if you want to re-issue a command you've used recently but don't want to have to type out a million arguements again.
Example:
Code:
johnshaw@Quaqmire-OSX ~ $ ps a
PID TT STAT TIME COMMAND
9664 p1 Ss 0:00.02 login -pf johnshaw
9665 p1 S 0:00.19 -bash
9935 p1 R+ 0:00.01 ps a
9861 p2 Ss 0:00.03 login -pf johnshaw
9862 p2 S 0:00.02 -bash
9863 p2 S+ 0:00.22 man pthread_join
9864 p2 S+ 0:00.01 sh -c (cd /usr/share/man && /usr/bin/tbl /usr/share/man/man3/pthread_join.3 | /u
9865 p2 S+ 0:00.01 sh -c (cd /usr/share/man && /usr/bin/tbl /usr/share/man/man3/pthread_join.3 | /u
9868 p2 S+ 0:00.01 /usr/bin/less -is
johnshaw@Quaqmire-OSX ~ $ !ps
ps a
PID TT STAT TIME COMMAND
9664 p1 Ss 0:00.02 login -pf johnshaw
9665 p1 S 0:00.19 -bash
9936 p1 R+ 0:00.01 ps a
9861 p2 Ss 0:00.03 login -pf johnshaw
9862 p2 S 0:00.02 -bash
9863 p2 S+ 0:00.22 man pthread_join
9864 p2 S+ 0:00.01 sh -c (cd /usr/share/man && /usr/bin/tbl /usr/share/man/man3/pthread_join.3 | /u
9865 p2 S+ 0:00.01 sh -c (cd /usr/share/man && /usr/bin/tbl /usr/share/man/man3/pthread_join.3 | /u
9868 p2 S+ 0:00.01 /usr/bin/less -is
johnshaw@Quaqmire-OSX ~ $