history
shell builtinLinux/Unix
The history command is one of the most frequently used commands in Linux/Unix-like operating systems. history Display or manipulate the command history list
Quick Reference
Command Name:
history
Category:
shell builtin
Platform:
Linux/Unix
Basic Usage:
history [options] [arguments]
Common Use Cases
Syntax
history [options] [n]
Options
Option | Description |
---|---|
-c |
Clear the history list |
-d offset |
Delete the history entry at position offset |
-a |
Append history lines to the history file |
-n |
Read all history lines not already read from the history file |
-r |
Read the history file and append the contents to the history list |
-w |
Write the current history to the history file |
-p |
Perform history expansion on the args and display the result without storing in the history list |
-s |
Add the args to the history list as a single entry |
Examples
How to Use These Examples
The examples below show common ways to use the history
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
history