So i had made it through the history section while fighting sleep and found a command that is fairly useful to use. Its one of those, “Why didnt I know about this command”. I am familiar with the history command but i have never used the “!!” or “!<#>” to reuse a command from history. Its pretty cool actually. Simple and sweet. Here is an example:
stor0:~$ history
1 sudo -i
2 exit
3 sudo -i
4 sudo -i
5 date
6 history
7 history 5
8 history 1
9 history 1
10 history 1!
11 exit
12 history
stor0:~$ !1
sudo -i
Password:
So look at the output of the history command. The first entry is “sudo -i” which drops me into the root user shell. Well instead of typing that LOOOOOONNGGGG command out I can just reuse it by typing “!1″. This may seen like a trivial matter but what till u have a rsync command and your in front of a console screen with no mouse support. Yeah just wait. Alternatively you can use the CTRL+r, which is the reverse search option and that may help if supported and the command is cached and of course the favored up/down arrows. OK back to reading.