为了便于查看操作记录,需要在history记录中加上时间显示
编辑/etc/bashrc文件,加入如下两行:
HISTTIMEFORMAT="%F %T " export HISTTIMEFORMAT
保存后退出,退出当前shell,并重新登录,再登录时就会有时间显示history记录了
#history .... 990 2015-02-11 14:04:50 cat update.php 991 2015-02-11 14:05:13 pwd 992 2015-02-11 18:16:05 exit 993 2015-02-12 09:49:04 cd /home/myoa/webroot/general/eis4/ 994 2015-02-12 09:49:06 ll 995 2015-02-12 09:49:10 vim index.php 996 2015-02-12 09:49:31 pwd 997 2015-02-12 10:25:27 cat index.php 998 2015-02-12 10:31:53 vim index.php 999 2015-02-12 10:32:44 cat index.php 1000 2015-02-12 11:14:48 vim index.php 1001 2015-02-13 09:26:53 history 1002 2015-02-13 09:27:02 history |less (END)
未经允许不得转载:SRE空间 » Linux使用history查看命令记录带时间
评论前必须登录!
注册