在/etc/profile或/etc/profile.d/下,或者在/etc/init.d/rc.local里加下面一段命令:ide
export HISTTIMEFORMAT="%F %T whoami "export PROMPT_COMMAND='{ msg=$(history 1 | { read x y; echo $y; }); logger "[euid=$(whoami)]":$(who am i):[pwd]"$msg";}'ui
whoami
pwd