给Linux的history日志 添加时间戳和用户名


在linux日常使用中,可以方便查看history中的哪个用户什么时间发的什么命令。

在 /etc/profile 中 添加
export HISTTIMEFORMAT="%F %T `whoami` "

效果:
1086 2017-07-24 18:51:23 root history
1087 2017-07-24 18:51:59 root vim /etc/profile
1088 2017-07-24 18:52:28 root source /etc/profile
1089 2017-07-24 18:52:31 root history
1090 2017-07-24 18:52:42 root vim /etc/profile
1091 2017-07-24 18:52:55 root source /etc/profile
1092 2017-07-24 18:52:58 root history


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM