Tuncay Sahin

ICT Engineer | Docent ICT & Trainer

Every command you run is recorded. You can check and reuse the command by showing the command history. Also you can check whe a command was runned.
You can use the arrow-up key to scroll through the commands last runned.

Display timestamp using HISTTIMEFORMAT

Typically when you type history from command line, it displays the command# and the command.
For auditing purpose, it may be beneficial to display the timepstamp along with the command as shown below.

# export HISTTIMEFORMAT=’%F %T ‘
# history | more

The output look likes:

1 2008-08-05 19:02:39 service network restart
2 2008-08-05 19:02:39 exit
3 2008-08-05 19:02:39 id
4 2008-08-05 19:02:39 cat /etc/redhat-release

Clear all the previous history using option -c

To clear all the previous history, but keep the history moving forward:

# history -c

Disable the usage of history using HISTSIZE

To disable history all together and don’t recorded the commands typed, set the HISTSIZE to 0 as shown below.

# export HISTSIZE=0
# history

Meer informatie

Voor meer informatie of voor een persoonlijk adviesgesprek kunt u altijd vrijblijvend contact met mij opnemen.