How To Recall Typed Commands In Linux?

For me Linux has always been a Command Line Interface (CLI) as opposed to a Graphical User Interface (GUI), learning commands the hard way is the best way to remember them, but why type over commands that you have already typed in a current or previous session in the console?

Here is a simple tip that will help you iterate through several commands you have typed in earlier on a *nix based console.

Instead of typing each and every command you have already typed, here are some simple steps that will save you time while recalling older commands you have already typed in the current or earlier sessions.

Step 1: Type Ctrl + R before issuing a command, this initiates the command re-caller in backward mode (most recent first).

Step 2: Type in few characters or part of the command u want to search for, for example if you want to lookup sudo commands you have typed in the past, just type in sudo.

Step 3: To scroll through past commands, keep using Ctrl + R till you find the command you are looking for.

Step 4: Hit enter when you find the command you want. or Ctrl + C to break the iteration loop.

Bonus Step: If you skipped through the command you wanted, you don’t have to start the search once again, just use Shift + Ctrl + R in the same loop to re-iterate through the commands in forward mode.

And for the bonus tip of this Linux Tips episode, just type in historyand hit enter to see a list of commands you have typed in the current session as well as previous sessions.

Published by

Keith Dsouza

I am the editor-in-chief and owner of Techie Buzz. I love coding and have contributed to several open source projects in the past. You can know more about me and my projects by visiting my Personal Website. I am also a social networking enthusiast and can be found active on twitter, you can follow Keith on twitter @keithdsouza. You can click on my name to visit my Google+ profile.