

[Note: Press enter when you see your command, (reverse-i-search)` red': cat /etc/redhat-release Which will display the reverse-i-search prompt] In the following example, I searched for red, which displayed the previous command “ cat /etc/redhat-release” in the history that contained the word red. When you’ve already executed a very long command, you can simply search history using a keyword and re-execute the same command without having to type it fully. I strongly believe, this may be your most frequently used feature of history.


# export HISTTIMEFORMAT='%F %T 'Ĥ 19:02:39 cat /etc/redhat-release 2. For auditing purpose, it may be beneficial to display the timepstamp along with the command as shown below. Typically when you type history from command line, it displays the command# and the command. In fact, once you have mastered the 15 examples that I’ve provided here, you’ll find using command line more enjoyable and fun.ġ. When you are using Linux command line frequently, using the history effectively can be a major productivity boost.
