Name
history — Print command-line history.
Synopsis
history [count
] history [options
]
Print commands in the history list or manage the history file. With no options or arguments, display the history list with command numbers. With a count argument, print only that many of the most recent commands.
Options
-a
Append new history lines (those executed since the beginning of the session) to the history file.
-c
Clear the history list (remove all entries).
-d
position
Delete the history item at position position.
-n
Read unread history lines from the history file into the history list.
-p
argument …
Perform csh-style history expansion on each argument, printing the results to standard output. The results are not saved in the history list.
-r
Read the history file and replace the history list with its contents.
-s
argument …
Store the arguments in the history list, as a single entry.
-w
Write the current history list to the history file, overwriting it entirely.
Get bash Pocket Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.