Command Line History

To see and choose previous commands you entered at the command line, use the up arrow. Up to 500 (you can change that number) of your last commands are stored in .bash_history (note the period before the file name).

To automatically run the previous command, use this:

!!

To run a command that you ran a while ago, use !, like this:

!cp

To see the list of commands in .bash_history, use:

history

To see a specific number of commands from history, use history , like this:

history 50

You can also use grep with history to find a specific command, like this:

history | grep m

This causes the entire history list to be sent to grep, which then prints to the screen only those commands that begin with m.

WebSanity Top Secret