优化history记录信息

1.修改添加/etc/profile内容

cat <<EOF >> /etc/profile           ##优化history记录历史
export HISTTIMEFORMAT="%F %T\`who -u am i 2>/dev/null| awk '{print \$NF}'|sed -e 's/[()]//g'\` \`whoami\` "
EOF

2.展示效果

id 日期 时间 ip 用户 命令

 

posted @ 2021-04-12 10:19  chenjianwen  阅读(59)  评论(0编辑  收藏  举报