HOME

TheInfoList



OR:

In
computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes, and development of both hardware and software. Computing has scientific, e ...
, various
shell Shell may refer to: Architecture and design * Shell (structure), a thin structure ** Concrete shell, a thin shell of concrete, usually with no interior columns or exterior buttresses ** Thin-shell structure Science Biology * Seashell, a hard o ...
s maintain a record of the commands issued by the user during the current session. The history command works with the
command history Command history is a feature in many operating system shells, computer algebra programs, and other software that allows the user to recall, edit and rerun previous commands. Command line history was added to Unix in Bill Joy's C shell of 1978 ...
list. When the command is issued with no options, it prints the history list. Users can supply options and arguments to the command to manipulate the display of the history list and its entries. The operation of the history command can also be influenced by a shell's
environment variables An environment variable is a dynamic-named value that can affect the way running processes will behave on a computer. They are part of the environment in which a process runs. For example, a running process can query the value of the TEMP envi ...
. For example, an environment variable can be set to control the number of commands to retain in the list.


History

In early versions of
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
the history command was a separate
program Program, programme, programmer, or programming may refer to: Business and management * Program management, the process of managing several related projects * Time management * Program, a part of planning Arts and entertainment Audio * Progra ...
. However, most shells have long included the history command as a shell built-in, so the separate program is no longer in common use.


Implementations

The command is available in various
Unix shell A Unix shell is a command-line Interpreter (computing), interpreter or shell (computing), shell that provides a command line user interface for Unix-like operating systems. The shell is both an interactive command language and a scripting langua ...
s, as well as in
PowerShell PowerShell is a task automation and configuration management program from Microsoft, consisting of a command-line shell (computing), shell and the associated scripting language. Initially a Windows component only, known as Windows PowerShell, it ...
,
ReactOS ReactOS is a free and open-source operating system for amd64/i686 personal computers intended to be binary-compatible with computer programs and device drivers made for Windows Server 2003 and later versions of Windows. ReactOS has been noted a ...
, and
KolibriOS KolibriOS, or Kolibri, is a small, open-source x86 operating system written completely in assembly. It was forked from MenuetOS in 2004 and has run under independent development since. In a 2009 review piece on alternative operating systems, ...
. It is also included as external command in
PTS-DOS PTS-DOS (aka PTS/DOS) is a disk operating system, a DOS clone, developed in Russia by PhysTechSoft and Paragon Technology Systems. History and versions PhysTechSoft was formed in 1991 in Moscow, Russia by graduates and members of MIPT, inf ...
where it keeps a resident part, sometimes in conventional memory. Since most current history commands are shell built-ins, details depend on the choice of
shell Shell may refer to: Architecture and design * Shell (structure), a thin structure ** Concrete shell, a thin shell of concrete, usually with no interior columns or exterior buttresses ** Thin-shell structure Science Biology * Seashell, a hard o ...
.


bash

The history command has the following syntax in
bash Bash or BASH may refer to: Arts and entertainment * ''Bash!'' (Rockapella album), 1992 * ''Bash!'' (Dave Bailey album), 1961 * '' Bash: Latter-Day Plays'', a dramatic triptych * ''BASH!'' (role-playing game), a 2005 superhero game * "Bash" ('' ...
:Darwin Kernel Version 15.0.0: Sat Sep 19 15:53:46 PDT 2015 history c d offset history -awrn ilename history -ps arg rg...


tcsh

The history command has the following syntax in
tcsh tcsh ( “tee-see-shell”, “tee-shell”, or as “tee see ess aitch”, tcsh) is a Unix shell based on and backward compatible with the C shell (csh). Shell It is essentially the C shell with programmable command-line completion, command-l ...
: history ''-hTr history -S, -L, -M ilename(+) history -c (+) The first form prints the history event list. If n is given only the n most recent events are printed or saved. With -h, the history list is printed without leading numbers. If -T is specified, timestamps are printed also in
comment Comment may refer to: * Comment (linguistics) or rheme, that which is said about the topic (theme) of a sentence * Bernard Comment (born 1960), Swiss writer and publisher Computing * Comment (computer programming), explanatory text or informa ...
form. (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. With -S, the second form saves the history list to filename. If the first word of the savehist shell variable is set to a number, at most that many lines are saved. If the second word of savehist is set to `
merge Merge, merging, or merger may refer to: Concepts * Merge (traffic), the reduction of the number of lanes on a road * Merge (linguistics), a basic syntactic operation in generative syntax in the Minimalist Program * Merger (politics), the comb ...
', the history list is merged with the existing history file instead of replacing it (if there is one) and sorted by time stamp. (+) Merging is intended for an environment like the
X Window The X Window System (X11, or simply X) is a windowing system for bitmap displays, common on Unix-like operating systems. X provides the basic framework for a GUI environment: drawing and moving windows on the display device and interacting wit ...
System with several shells in simultaneous use. Currently it succeeds only when the shells quit nicely one after another. 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. -M is like -L, but the contents of filename are merged into the history list and sorted by
timestamp A timestamp is a sequence of characters or encoded information identifying when a certain event occurred, usually giving date and time of day, sometimes accurate to a small fraction of a second. Timestamps do not have to be based on some absolut ...
. In either case, histfile is used if filename is not given and ~/.history is used if histfile is unset. `history -L' is exactly like 'source -h' except that it does not require a filename. Note that login shells do the equivalent of `history -L' on startup and, if savehist is set, `history -S' before exiting. Because only ~/.tcshrc is normally sourced before ~/.history, histfile should be set in ~/.tcshrc rather than ~/.login. If histlit is set, the first and second forms print and save the literal (unexpanded) form of the history list. The last form clears the history list.


PowerShell

In
PowerShell PowerShell is a task automation and configuration management program from Microsoft, consisting of a command-line shell (computing), shell and the associated scripting language. Initially a Windows component only, known as Windows PowerShell, it ...
, ''history'' is a predefined command alias for the Get-History
cmdlet PowerShell is a task automation and configuration management program from Microsoft, consisting of a command-line shell and the associated scripting language. Initially a Windows component only, known as Windows PowerShell, it was made open-sou ...
. In addition, PowerShell includes the Add-History, Clear-History, Get-History, and Invoke-History cmdlets. The *-History cmdlets serve the same purpose as the
Unix-like A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
history command. Get-History -Id] -Count] CommonParameters> Add-History -InputObject] ] [-Passthru] CommonParameters> Clear-History -Id] -Count] [-Newest]
Confirm In Christian denominations that practice infant baptism, confirmation is seen as the sealing of the covenant (religion), covenant created in baptism. Those being confirmed are known as confirmands. For adults, it is an wikt:affirmation, affirma ...
WhatIf CommonParameters> Clear-History -Count] CommandLine_">html"_;"title="CommandLine_CommandLine_[-Newest.html" ;"title=">CommandLine_.html" ;"title="html" ;"title="CommandLine CommandLine ">html" ;"title="CommandLine CommandLine [-Newest">>CommandLine_.html" ;"title="html" ;"title="CommandLine CommandLine ">html" ;"title="CommandLine CommandLine [-Newest
Confirm In Christian denominations that practice infant baptism, confirmation is seen as the sealing of the covenant (religion), covenant created in baptism. Those being confirmed are known as confirmands. For adults, it is an wikt:affirmation, affirma ...
WhatIf CommonParameters> Invoke-History -Id]
Confirm In Christian denominations that practice infant baptism, confirmation is seen as the sealing of the covenant (religion), covenant created in baptism. Those being confirmed are known as confirmands. For adults, it is an wikt:affirmation, affirma ...
WhatIf CommonParameters>


ReactOS Command Prompt

The history command of the
ReactOS ReactOS is a free and open-source operating system for amd64/i686 personal computers intended to be binary-compatible with computer programs and device drivers made for Windows Server 2003 and later versions of Windows. ReactOS has been noted a ...
Command Prompt Command Prompt, also known as cmd.exe or cmd, is the default command-line interpreter for the OS/2, eComStation, ArcaOS, Microsoft Windows (Windows NT family and Windows CE family), and ReactOS operating systems. On Windows CE .NET 4.2, W ...
currently only supports printing the history list.


See also

*
List of command-line interpreters In computing, a command-line interpreter, or command language interpreter, is a blanket term for a certain class of programs designed to read lines of text entered by a user, thus implementing a command-line interface. Operating system shells ...


References


Further reading

* {{Unix commands ReactOS commands Unix software Windows administration