Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Log commands history of multiple users in same time with details
# add to .bashrc
# Avoid duplicates
export HISTCONTROL=ignoredups:erasedups
# When the shell exits, append to the history file instead of overwriting it
shopt -s histappend
# After each command, append to the history file and reread it
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
# History Datetime
export HISTTIMEFORMAT='%F %T '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment