Last Updated: February 25, 2016
·
381
· alme1304

Execute previous commands

You could press the up arrow to cycle through your previous commands,or you could use the history command.

The command will show your previous commands, when you find the one you want, you can call it be typing !xx, where xx is the number of the command.

2 Responses
Add your response

You can use the last command with two exclamation marks. It also outputs the full command with the exclamation marks replaced, just to show you. Below is an example with whoami executed by the user seawolf:

$  whoami
seawolf

$ sudo !!
sudo whoami
[sudo] password for seawolf: **********
root
over 1 year ago ·

If you press ctrl+R and then start typing you can search in your command history.

over 1 year ago ·