This one’s a quickie. Just a second of my config to record all bash commands to a file (.bash_eternal_history) forever. The default bash HISTFILESIZE is 500. Setting it to a non-numeric value will make the history file grow forever (although not your actual history size, which is controlled by HISTSIZE).
I do this in addition:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
#~/.bash.d/eternal-history # don't put duplicate lines in the history HISTCONTROL=ignoredups # append to the history file, don't overwrite it shopt -s histappend # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) HISTFILESIZE=infinite # Creates an eternal bash log in the form # PID USER INDEX TIMESTAMP COMMAND export HISTTIMEFORMAT="%s " PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ; }"'echo $$ $USER \ "$(history 1)" >> ~/.bash_eternal_history' |