Centos的历史命令历史记录添加执行时间

  

Centos历史命令历史记录添加执行时间

  

在/etc/profile尾部加入以下环境变量

  
 <代码>出口HISTTIMEFORMAT=' % F % T '  
  

 Centos历史命令历史记录添加执行时间

  

执行环境变量生效

  
 <代码>源/etc/profile  
  

测试结果

  
 <代码> [root@localhost network-scripts] #历史
  1 2019-12-06 13:57:01自由- m
  2 2019-12-06 13:57:32猫/proc/cpuinfo
  3 2019-12-06 13:57:39最高
  4 2019-12-06 13:58:19噢
  5 2019-12-06 13:58:27 cd/etc/sysconfig/network-scripts/6 2019-12-06 13:58:27 ls
  7 2019-12-06 13:58:28噢
  8 2019-12-06 13:58:41 ip addr
  9 2019-12-06 13:58:46 vim ifcfg-em1
  10 2019-12-06 13:58:51 yum安装使用vim - y
  11 2019-12-06 14:01:23历史
  12 2019-12-06 14:04:15 vim/etc/profile
  13 2019-12-06 14:04:48源/etc/profile
  14 2019-12-06 14:04:50历史
  15 2019-12-06 14:05:13 vim/etc/profile
  16 2019-12-06 14:05:22源/etc/profile
  17 2019-12-06 14:05:23历史
  [root@localhost network-scripts) #
  #命令的间隔可以在定义环境变量时自已调整 

Centos的历史命令历史记录添加执行时间