Skip to main content

Navigating history

Remember that the shell keeps a command history. You can see the history of commands by using history:

% history

You can also get back to previous commands by pressing the up arrow key - and then the down arrow key moves you forward through the commands as well, until you get back to the one you were about to type. Having found the command you want, you can then edit it (including using the left arrow key, or backspace) before running it again.

Note

This is useful when you've typed some complex command a minute ago, and want to repeat it - just press up arrow until you find it again.