Skip to content

Instantly share code, notes, and snippets.

@tayyebi
Last active August 16, 2022 10:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tayyebi/5e03f83dff1b897a51e530748d74e872 to your computer and use it in GitHub Desktop.
Save tayyebi/5e03f83dff1b897a51e530748d74e872 to your computer and use it in GitHub Desktop.
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 '
# Add a cute dog to my temrinal
PS1="🦮 $ "
# Be polite!
alias please="sudo"
# Show progress bar with unzip (based on stackoverflow#909918); usage: punzip file.zip
function plunzip {
for f in $(unzip -Z -1 $1 | grep -v '/$');
do
[[ "$f" =~ "/" ]] && mkdir -p ${f%/*}
echo "Extracting $f"
unzip -o -c $1 $f \
| pv -s $(unzip -Z $1 $f | awk '{print $4}') \
> $f
done
}
@tayyebi
Copy link
Author

tayyebi commented Aug 15, 2022

Then simply run source .bashrc to instantly see the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment