6. Command history

The command line looks quite primitive but has several features which allow you to work very efficiently. One of the most useful is the command history.

  • Run some commands from the last session, like ls, cd or find, then use the up and down arrows to avoid re-typing.
  • Go back in the command history and press Ctrl-o. What happens? If you have to repeat sequences of commands, this can be very handy!

What does history do?

$ man history

will tell you more than you’ll ever need to use.

What’s in the file ~/.bash_history? You can re-write history if you want.