Always we need to keep on repeating the same commands again and again. In Linux, there is a program that records each command that we type into a terminal called history. However it is understood that by typing ‘history’ over and over again each time we would like to search for the previous commands are time consuming. To get around with this, the terminal allow us to use UP arrow to get back those commands. But again, it would be taking a long time to keep searching until we are able to locate the command IF it is being typed long while ago. There are always better way, which is using CTRL+R at and empty command prompt. It should looks like this:
(reverse-i-search)`’:
By providing just partially of a previous command that we are looking for, we will find the most recent command that matches the characters AS we type them.
The other cool way is using grep command. It is relatively simple and should look something like this:
host@machine [504]$ history | grep jetty
471 jetty-dump-servlet-xss 192.168.1.10
472 less /opt/scripts/jetty-dump-servlet-xss/1/0.t
504 history | grep jetty