history su root cat /etc/profile # add to end line export HISTTIMEFORMAT="%F %T `who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'` `whoami` " # save and source source /etc/profile