What command did I type before ?

. History command

  • “history” command will output the recently-executed commands recorded in a history list.
  • More details about available in the man

. Searching through the Command History ( CTRL+R )

  • Use the CTRL+R keys to perform a “reverse-i-search”. For example, if you wanted to use the command you used the last time you used grep, you would type:
  • CTRL-R then type “grep”.
  • What you will see in the console window is:
        (reverse-i-search)`':
    
  • After you have typed what you are looking for, use the CTRL-R key combination to scroll backward through the history.
  • Use CTRL+R repeatedly to find every reference to the string you've entered. Once you've found the command you're looking for, use [Enter] to execute it. Alternatively, using the right or left arrow keys will place the command on an actual command-line so you can edit it.