Beginner Package: bash builtin

history

Show previously run commands.

Syntax

history [options]

Description

history lists the commands you've previously run in this shell, each with a number that can be reused to re-run it instantly with !number, which is much faster than retyping a long command.

Examples

history
Show your recent command history
history | grep rsync
Search your history for a specific command
!245
Re-run command number 245 from your history
Ctrl+R
Interactively search history as you type (keyboard shortcut, not a command)

Applies to

Ubuntu Debian Linux Mint RHEL CentOS / Rocky / AlmaLinux Fedora Arch Linux openSUSE Alpine Linux