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 用户 命令
原文:https://www.cnblogs.com/chenjw-note/p/14646844.html