The history command

Display or manipulate the history list. 8 examples from the lessons of the IVski Linux Playground — try them in the terminal next to them.

Options in the examples

-c
clear the history list by deleting all of the entries -d offset delete the history entry at position OFFSET.

Examples

history | grep ssh
history | tail -20

Last 20 commands

history | awk '{print $2}' | sort | uniq -c | sort -rn | head -10
history

All history

history 20

Last 20 commands

history | grep apt
history -c

Clear current session history

history -d 100

Delete entry 100

Lessons that use history

Related commands