Forrest logo
tool overview
On this page you find all important commands for the CLI tool history. If the command you are looking for is missing please ask our AI.

history

"history" is a command line tool that is widely used in Unix-based operating systems like Linux and macOS. It allows users to view a list of previously executed commands in their terminal session.

The tool maintains a chronological record of commands entered by a user, along with their execution time. It can be accessed using the "history" command itself, often followed by options and arguments.

By default, history displays a numbered list of commands, starting from the most recent one. This list can be filtered, sorted, or displayed in various formats based on the options provided. Users can also search through their command history using specific keywords, regular expressions, or unique identifiers.

History can be helpful when recalling previously used commands, avoiding repetition, and maintaining a log of executed tasks. It aids in troubleshooting or repeating lengthy or complex commands. Users can easily re-execute a desired command from history by using the corresponding command number.

The number of commands stored in history is limited by the value of the HISTSIZE environment variable. Users can configure this variable to adjust the size of their command history.

The command history can be customized using various settings, such as ignoring duplicates, timestamp formatting, or excluding specific commands. Users can also clear their command history if desired.

Furthermore, history supports command substitution, allowing users to recall and modify previously executed commands through a simple syntax.

Overall, history is a valuable command line tool that improves productivity, helps recall past commands, and offers flexibility in managing the command history in Unix-like systems.

List of commands for history:

  • history:tldr:3cd15 history: Display the commands history list with line numbers.
    $ history
    try on your machine
    explain this command
  • history:tldr:413a4 history: Display the last 20 commands (in `zsh` it displays all commands starting from the 20th).
    $ history ${20}
    try on your machine
    explain this command
  • history:tldr:7b6d0 history: Overwrite history file with history of current `bash` shell (often combined with `history -c` to purge history).
    $ history -w
    try on your machine
    explain this command
  • history:tldr:9c5f3 history: Delete the history entry at the specified offset.
    $ history -d ${offset}
    try on your machine
    explain this command
  • history:tldr:e6ed2 history: Clear the commands history list (only for current `bash` shell).
    $ history -c
    try on your machine
    explain this command
tool overview