I found another great thing linux provides for the lazy programmers ;) Most of the time we need to repeat the commands we entered in linux terminal and many hardworking engineers typing it again and again ;)

Famous quote “Those who cannot remember the past are condemned to repeat it” preety much applies here when you use commandline mode to operate your machine or working on remote server via ssh.

Linux provides many tools which remembers history and on top of that we can make our life easy.

Usually i work on servers and whenever try to fire few root access commands and it dont allow me!! -_-,feels insulting. Anyway sudo !! is here to rescue you :)

amey@amey-xps:~/$ touch /etc/apache2/apache2.conf 
touch: cannot touch ‘/etc/apache2/apache2.conf’: Permission denied
amey@amey-xps:~/work/blog/codeinventory.github.io/_posts$ sudo !!
sudo touch /etc/apache2/apache2.conf 
[sudo] password for amey: 

Not only sudo, Bang (!) can do may more things <3

Repeating Commands

Repeat last command


Repeat last command that started with x


Repeat last command that has the substring x


Repeat 10th command in the history file


Repeat 10th from last command in the history file


Fetching Parameters

Fetch parameters from last command


Fetch first parameter from last command


Fetch last parameter from last command


Fetch third parameter from last command



Repeat last command substituting foo for bar


Happy coding ….. :)