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
    
    * * * 胖并快乐着的死肥宅 * * *
  • 相关阅读:
    POJ 3009
    POJ 3253
    POJ 3617
    POJ 3984
    UVA10012
    HDU5100
    HDU 5101
    UVA301 运输
    UVA 331 交换的方案数
    uva 10344 算23点
  • 原文地址:https://www.cnblogs.com/bpzblog/p/14477256.html
Copyright © 2011-2022 走看看