HISTTIMEFORMAT 设置历史命令时间的格式

echo ‘HISTTIMEFORMAT=”%F %T `whoami`”  ‘ >>/etc/bashrc

whoami 完了后面要有空格不然会连住和命令

在/etc/bashrc下面添加一行:

HISTTIMEFORMAT=”%F %T `whoami` “

97 2019-08-15 10:20:14 root HISTTIMEFORMAT=”%F %T `whoami` ”
98 2019-08-15 10:20:16 root ls
99 2019-08-15 10:20:17 root pwd
100 2019-08-15 10:20:20 root cd /
101 2019-08-15 10:20:21 root ls
102 2019-08-15 10:20:24 root cd /etc/
103 2019-08-15 10:20:26 root ls
104 2019-08-15 10:20:29 root history
第几个命令  几点  哪个用户执行了什么命令

This entry was posted in bash, LinuxBasic and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *