給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