How to record timestamp of each command in history

There's no timestamp of each command when we are using 'history ' command to see the command records.

We can add timestamp for each command by following steps:

1. Edit ~/.bashrc or /etc/bashrc

export HISTTIMEFORMAT="%m-%d-%Y %H:%M:%S "

Note: m, d are in lowercase, Y, H, M, S are in uppercase.

          There's a blank between 'S' and the last Quote Mark.

2. Save the bashrc file, and use 'source ' command to reload the bashrc config file.

3. Done.

猜你喜欢

转载自iintothewind.iteye.com/blog/1287875