$ history
Display or manipulate the command history list
DOCUMENTEDShell builtinsUbuntu 24.04 LTS baseline
Synopsis
history [n] or history -c ...
What it does
- Bash maintains a history list of commands according to its history settings.
- History behavior can be affected by shell options and variables such as `HISTFILE`.
Examples
Show recent commands
historyShow the last 20 commands
history 20Important details
These examples are intentionally conservative. Command behavior can still depend on filesystem state, permissions, locale, shell, installed package version, and other system configuration.
For exact option semantics, the linked authoritative documentation is the source of truth.