Otago Study Group SYSKA

The OtagoStudyGroup Stuff You Should Know About blog

Bash history

One of the most useful additions to my .bashrc file that I have found is the addition of this command to save all the commands that I run into a log file. export PROMPT_COMMAND='if [ "$(id -u)" -ne 0 ]; then echo "$(date "+%Y-%m-%d.%H:%M:%S") $(pwd) $(history 1)" >> ~/.logs/bash-history-$(date "+%Y-%m-%d").log; fi' This is super useful because it saves a new file for each day of all of the timestamped commands that I have run and the directory I was in when I ran them. Read more →