Format
history [first[last]]
tcsh
shell:
history [-hTr]
[n]
history -S|-L|-M [filename]
history -c
Description
history is
an alias for fc –l. Like fc
–l, history displays the list
of commands that have been input to an interactive shell. This command
does not edit or reenter the commands. If you omit last, history displays
all commands from the one indicated by first through
to the previous command entered. If you omit both first and last with
this command, the default command range is the 16 most recently entered
commands.
See
fc — Process a command history list for more information.
For
the tcsh shell,
history, when used alone,
prints the history event list. If
n is given
only the
n most recent events are printed
or saved.
The tcsh shell
history built-in
command uses the following options:
- With -h, the history list is printed
without leading numbers.
- With -T, timestamps are printed also
in comment 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, history 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, 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
System with several shells in simultaneous use. Currently it only
succeeds when the shells quit 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. 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.
- With -c, clears the history list.
tcsh 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 form (history [-hTr]
[n]) and second form (history -S|-L|-M [filename])
print and save the literal (unexpanded) form of the history list.
Related information
fc, sh, tcsh