How to implement the history command to view time and user

The default command execution history
How to implement the history command to view time and user
of how the execution time plus the command of it, here we must use HISTTIMEFORMAT variable, the following is a temporary modification, after the system restart will fail

[root@centos7-test ~]# export HISTTIMEFORMAT="%F %T whoami "

The result of executing the history command again is as follows: It
How to implement the history command to view time and user
takes effect permanently. It needs to be written to the configuration file, which can be written to the profile in the user's home directory. Use source to make the configuration take effect.

How to implement the history command to view time and user
Restart the host and verify whether it is successful.
How to implement the history command to view time and user
If all users take effect, you need to write to /etc/profile and then source /etc/profile.

Guess you like

Origin blog.51cto.com/15092993/2607489