Hack 54. Execute previous command that starts with a specific word

Type ! followed by the starting few letters of the command that you would like to re-execute. In the following example, typing !ps and enter, executed the previous command starting with ps, which is ‘ps aux | grep yp’.

# !ps
ps aux | grep yp
       root     16947  0.0  0.1  36516  1264 ?        Sl   13:10   0:00 ypbind
       root     17503  0.0  0.0   4124   740 pts/0    S+   19:19   0:00 grep yp

Comments on this entry are closed.