首页 > 其他 > 详细

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

时间:2019-12-06 18:58:18      阅读:148      评论:0      收藏:0      [点我收藏+]
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]# 
# 命令的间隔可以在定义环境变量时自已调整

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

原文:https://blog.51cto.com/zhongliang/2456631

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!