让linux的history命令显示操做时间

不少人都会用到history这个命令,这个命令的意思就是列出来当前用户的全部操做(默认如此),可是不少发行版的默认的history是没有用户和操做时间的,这个对于须要查看原来的操做内容的时候就提供了麻烦,man 了下history,发现有个变量是能够设定history这个显示格式的,这个变量就是HISTTIMEFORMATios

只要export HISTTIMEFORMAT="`whoami` : |  %F  | %T: | "bash

而后就能够看到带有用户和时间的history了,把这个保存到当前用户的.bash_profile里面,就能够开机自动加载了ide

下面的是显示效果:spa

  330  root : |  2012-08-24  | 17:47:12: | yum search nfsget

  331  root : |  2012-08-24  | 17:47:12: | yum install nfs4-acl-toolsit

  332  root : |  2012-08-24  | 17:47:12: | nfsiostat io

  333  root : |  2012-08-24  | 17:47:12: | nfs4_editfacl class

  334  root : |  2012-08-24  | 17:47:12: | nfs4_editfacl --help变量

  335  root : |  2012-08-24  | 17:47:12: | man nfs4_editfaclfile

  336  root : |  2012-08-24  | 17:47:12: | nfs4_getfacl 

  337  root : |  2012-08-24  | 17:47:12: | nfs4_getfacl -h

  338  root : |  2012-08-24  | 17:47:12: | nfs4_getfacl -H

  339  root : |  2012-08-24  | 17:47:12: | nfs4_getfacl -H

  340  root : |  2012-08-24  | 17:47:12: | ls

  341  root : |  2012-08-24  | 17:47:12: | ifconfig

相关文章
相关标签/搜索