To start recording the date and time that each command is executed, set the EXTENDED_HISTORY environment variable to ON:
export EXTENDED_HISTORY=ON
The CUT (Coordinated Universal Time) timestamp will be appended to each line of the ~/.sh_history file.
The command history can be displayed with various history or fc (fix command) commands:
history
fc -l
history n
fc -l n
fc -t
history -t
fc -t n
history -t n
n specifies which command the listing is to start with. If it is negative, then the listing starts with the nth previous commmand; if it is non-negative, the listing starts with the specified command number. If -t is specified, the output will include the timestamps.
r
without any parameters repeats the preceding command.
r searchtext
repeats the last command starting with the given search text.
r -n
repeats the nth previous command.
r n
repeats the specified command. The number of a command can be determined by displaying the command history or by setting the prompt to include the command number.
Home > Computers > Operating Systems > UNIX > Shell > Korn > History
Viewing mobile website page. Switch to WML or Full HTML