Go2Linux | Linux Operating System

A site dedicated to: Linux Operating System

Small tip - Call a command from history

Date: 2009-01-04 00:00:00 -0400

History is a Linux Operating System command, that lets you review the last commands used, so you can use it again.

To learn a bit more about history read: History Linux command, once you have found the command you need, there is no need to re-write it or cut and paste it, just enter ! followed with the number of the command you want to reuse, with no spaces in the middle, and that is:

Check this example:

history

  466  man nohup 
  467  sudo aptitude install coreutils
  468  sudo vim /etc/apt/apt.conf
  469  sudo aptitude install coreutils
  470  man nice
  471  sudo aptitude update
  472  man nice

so if I enter this command:

!470

The man page of nice will be displayed on your screen.

If you liked this article please share it.

powered by TinyLetter

If you want to contact me in any other way, please use the contact page.