linux设置执行的命令写入日志
vim /etc/profile
##添加以下内容到末尾
export HISTTIMEFORMAT="[%Y-%m-%d %H:%M:%S] [`who am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`] " export PROMPT_COMMAND='if [ -z "$OLD_PWD" ];then export OLD_PWD=$PWD; fi; if [ ! -z "$LAST_CMD" ] && [ "$(history 1)" != "$LAST_CMD" ]; then logger -t `whoami`_shell_cmd "[$OLD_PWD]$(history 1)"; fi ; export LAST_CMD="$(history 1)"; export OLD_PWD=$PWD;'
source /etc/profile
cd && echo "source /etc/profile" >> .bashrc