The history
command in C Shell (csh) is used to display a list of previously executed commands in the current shell session. This allows users to easily recall and reuse commands without having to retype them.
The basic syntax of the history
command is as follows:
history [options] [arguments]
-c
: Clear the history list.-n
: Read the history from the history file and append it to the current history list.-r
: Read the history from the history file and replace the current history list.-w
: Write the current history list to the history file.history
history -c
history -r
history -w
history 10
!n
to execute the command at position n
in the history list.!!
.history -w
regularly to save your command history, especially before closing the terminal.