Curiosity › Technology › Computers and Smartphones › How to view the history of all the commands typed in Ubuntu? › Reply To: How to view the history of all the commands typed in Ubuntu?
The command is history
. It lists around 500 commands that you have recently typed. You can filter the most recent commands with history x
where x is the number of commands you’d like to see. You can also use grep
alongside with the history command to search for a specific keyword. E.g. history | grep foo
.
And to use a command, you can use !
followed by the command number. E.g, !523
will run the 523rd command you typed. And !!
will execute the last command you typed (comes handy if you forget sudo
. You can just sudo !!
instead of typing it all again.