Centos History 命令歷史記錄添加執行時間


Centos History 命令歷史記錄添加執行時間

在/etc/profile尾部加入以下環境變量

 export HISTTIMEFORMAT='%F %T'

執行環境變量生效

source /etc/profile

測試結果

[root@localhost network-scripts]# history 
  1 2019-12-06 13:57:01 free -m
  2 2019-12-06 13:57:32 cat /proc/cpuinfo
  3 2019-12-06 13:57:39 top
  4 2019-12-06 13:58:19 ll
  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 ll
  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 install vim -y
  11 2019-12-06 14:01:23 history
  12 2019-12-06 14:04:15 vim /etc/profile
  13 2019-12-06 14:04:48 source /etc/profile
  14 2019-12-06 14:04:50 history
  15 2019-12-06 14:05:13 vim /etc/profile
  16 2019-12-06 14:05:22 source /etc/profile
  17 2019-12-06 14:05:23 history
[root@localhost network-scripts]#
# 命令的間隔可以在定義環境變量時自已調整




免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM