We have multiple guys logged in as root at the same time. How can I view their command history during login or after terminating their session.
Regards,
I merge them in the configuration file using:
shopt -s histappend
This is usually enough for me to see session info after the logout (by examining the history file). I also timestamp with:
export HISTTIMEFORMAT='%m-%d-%Y %H:%M:%S '
Some people also set the history to reload and popular after each command. I don't, but this is the popular recipe for that:
# Save and reload the history after each command finishes
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
All of this ends up in a /etc/bashrc or a snippet in /etc/profile.d/