encyclopegia.org

History (command)

In computing, various shells maintain a record of the commands issued by the user during the current session.[src] The history command works with the command history list.[src] When the command is issued with no options, it prints the history list.[src] Users can supply options and arguments to the command to manipulate the display of the history list and its entries.[src] The operation of the history command can also be influenced by a shell's environment variables.[src] For example, an environment variable can be set to control the number of commands to retain in the list.[src]

In computing, various shells maintain a record of the commands issued by the user during the current session.[src] The history command works with the command history list.[src] When the command is issued with no options, it prints the history list.[src] Users can supply options and arguments to the command to manipulate the display of the history list and its entries.[src] The operation of the history command can also be influenced by a shell's environment variables.[src] For example, an environment variable can be set to control the number of commands to retain in the list.[src] ==History== In early versions of Unix the history command was a separate program.[src] However, most shells have long included the history command as a shell built-in, so the separate program is no longer in common use.[src] ==Implementations== The command is available in various Unix shells, as well as in PowerShell, ReactOS, and KolibriOS.[src] It is also included as external command in PTS-DOS where it keeps a resident part, sometimes in conventional memory.[src] Since most current history commands are shell built-ins, details depend on the choice of shell.[src] ===bash=== The history command has the following syntax in bash: history [-c] [-d offset] [n] history -awrn [filename] history -ps arg [arg...] ===tcsh=== The history command has the following syntax in tcsh: history [-hTr] [n] history -S|-L|-M [filename] (+) history -c (+) The first form prints the history event list.[src] If n is given only the n most recent events are printed or saved.[src] With -h, the history list is printed without leading numbers.[src] If -T is specified, timestamps are printed also in comment form.[src] (This can be used to produce files suitable for loading with 'history -L' or 'source -h'.) With -r, the order of printing is most recent first rather than oldest first.[src] With -S, the second form saves the history list to filename.[src] If the first word of the savehist shell variable is set to a number, at most that many lines are saved.[src] If the second word of savehist is set to `merge', the history list is merged with the existing history file instead of replacing it (if there is one) and sorted by time stamp.[src] (+) Merging is intended for an environment like the X Window System with several shells in simultaneous use.[src] Currently it succeeds only when the shells quit nicely one after another.[src] With -L, the shell appends filename, which is presumably a history list saved by the -S option or the savehist mechanism, to the history list.[src] -M is like -L, but the contents of filename are merged into the history list and sorted by timestamp.[src] In either case, histfile is used if filename is not given and ~/.history is used if histfile is unset.[src] `history -L' is exactly like 'source -h' except that it does not require a filename.[src] Note that login shells do the equivalent of `history -L' on startup and, if savehist is set, `history -S' before exiting.[src] Because only ~/.tcshrc is normally sourced before ~/.history, histfile should be set in ~/.tcshrc rather than ~/.login.[src] If histlit is set, the first and second forms print and save the literal (unexpanded) form of the history list.[src] The last form clears the history list.[src] ===PowerShell=== In PowerShell, history is a predefined command alias for the Get-History cmdlet.[src] In addition, PowerShell includes the Add-History , Clear-History , Get-History , and Invoke-History cmdlets.[src] The *-History cmdlets serve the same purpose as the Unix-like history command.[src] Get-History [[-Id] ] [[-Count] ] [ ] Add-History [[-InputObject] ] [-Passthru] [ ] Clear-History [[-Id] ] [[-Count] ] [-Newest] [-Confirm] [-WhatIf] [ ] Clear-History [[-Count] ] [-CommandLine ] [-Newest] [-Confirm] [-WhatIf] [ ] Invoke-History [[-Id] ] [-Confirm] [-WhatIf] [ ] ===ReactOS Command Prompt=== The history command of the ReactOS Command Prompt currently only supports printing the history list.[src] ==See also== List of command-line interpreters ==References== ==Further reading==[src]

40 sentences · 40 cited inline · 0 references stored

References

No reference rows published for this article.

Cite this article

MLA

"History (command)." encyclopegia.org, 2026, https://encyclopegia.org/wiki/history-command. Accessed 25 November 2026.

Chicago

"History (command)." encyclopegia.org. Accessed November 25, 2026. https://encyclopegia.org/wiki/history-command.

APA

encyclopegia.org. (2026). History (command). Retrieved November 25, 2026, from https://encyclopegia.org/wiki/history-command

Accessed November 25, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

history of Lyon

stub · references available

Category:History of Benin

stub · references available

Category:History of the Philippines

stub · references available

history of France

stub · references available

history of French cuisine

stub · references available

history of Burgundy

stub · references available

history of dance

stub · references available

History of Ming

stub · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1378833399 · 0.5 · snapshot enwiki-001378833399

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.