zoukankan      html  css  js  c++  java
  • history历史记录增加显示时间和用户

    history只有行号不方便便

    增加现实时间和用户更清楚

    [08:50:43 root@c7-1-54 ~]#HISTTIMEFORMAT="%F %T `whoami`  "
    [08:51:03 root@c7-1-54 ~]#history
        1  2021-03-03 08:48:12 root  ifconfig
        2  2021-03-03 08:48:12 root  hostname -I
        3  2021-03-03 08:48:12 root  cat /etc/hostname
        4  2021-03-03 08:48:12 root  /etc/hostname < C7
        5  2021-03-03 08:48:12 root  echo C7 < /etc/hostname
        6  2021-03-03 08:48:12 root  cat /etc/hostname
        7  2021-03-03 08:48:12 root  cat /etc/hostname
        8  2021-03-03 08:48:12 root  vi /etc/hostname
    

    将如上配置写入配置文件永久生效

    [08:59:15 root@C8-3-55 ~]#vim .bash_profile
    
    

    修改配置文件

    # .bash_profile
    
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
            . ~/.bashrc
    fi
    
    # User specific environment and startup programs
    
    PATH=$PATH:$HOME/bin
    
    export PATH
    
    export HISTTIMEFORMAT="%F %T `whoami`  "  ##在末尾添加格式化语句
    
    

    使文件立即生效

     1057  2021-03-03 08:59:12 root  . .bash_profile
     1058  2021-03-03 08:59:15 root  history
    
    * * * 胖并快乐着的死肥宅 * * *
  • 相关阅读:
    php去除数组中重复值,并返回结果!
    SignalR 2 入门
    SignalR支持的平台
    SignalR简介
    作业调度系统quartz.net
    Oracle安装心得
    maven的项目目录解析
    web.xml的<url-parttern>的匹配规则
    Web.xml中四种验证方式
    Web.xml
  • 原文地址:https://www.cnblogs.com/bpzblog/p/14477256.html
Copyright © 2011-2022 走看看