Mohammedz.com

For Linux and Shell scripting.

HISTTIMEFORMAT: add execution time to Linux’s history file

Leave a comment


As you might know, Linux logs all the commands executed on a shell prompt to its history file. The file is .bash_history by default, but you can change it. Also, you can change HISTTIMEFORMAT to enable timestamping to history.

If you add the following line to your bashrc or bash_profile, the time stamp information associated with each history entry will be written to the history file.

HISTTIMEFORMAT=”%h-%d-%Y – %H:%M:%S ”

Regards,
Mohammed.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s