See previous commands 🔙 you entered at the command line

To see and choose previous commands, use the up arrow. Up to 500 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 !<command>, like this:


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


To see a specific number of commands from history, use history <number>, 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.

Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.