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.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>