Hacker News new | ask | show | jobs
by doersino 1234 days ago
A blog post on how to make your Bash history more useful: https://excessivelyadequate.com/posts/history.html
1 comments

Neat.

Simple way to track time spent on projects that is resilient to user forgetfulness. Much better than collecting timestamps from git commits. Could be interesting to merge with git history and measure how productivity (some combo of bash activity and git activity and lines-of-code/Kolmogorov-complexity) change with time-of-day, season, weather, etc.

# store timestamps

export HISTTIMEFORMAT="%F %T "

# append immediately (affects timestamps?)

PROMPT_COMMAND="$PROMPT_COMMAND; history -a"

# do not limit .bash_history file size

export HISTFILESIZE=""

# append mode (collect from multiple shells)

shopt -s histappend

# multi-line commands as single record

shopt -s cmdhist