List and run last used commands in Linux

To list through most recently used commands one by one use Arrow-Up key

To display all used commands:
history

To run a command from the history list:
!391
where 391 command number



To find a particular command in your history:
history | grep command
where command part of the command you are after

Your history is saved in a file:
/root/.bash_history
where root your user name


Newsletter

Subscribe to receive occasional updates on new posts.
Your email will not be used for any other purpose and you can unsubscribe at any time.
Please wait