Session and utilities
The history command
Shows the commands you have typed in this session, numbered.
Syntax
historyCopy-ready examples
$ historyYour whole history$ history | tail -n 5The last fiveYou can try them in the browser terminal: it does not touch your computer.
Typical mistakes
- In bash, Ctrl+R searches the history without leaving the current line.
FAQ
How do I repeat the last command?
With the up arrow, or by typing !! in bash.
Learn to actually use it
The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.
Start the free course