I use a static, curated history of commands in my shell. The idea is simple: whenever I open a new terminal window, Bash comes preloaded with a fixed history of commands, which I have manually collected over the years and which I update every so often. I currently have 195 commands in my history file.
Doing this is so much better than the standard behavior that I feel stupid for all the years I spent not doing it!
For some time, I just changed the permissions of ~/.bash_history so that Bash would never write to it. Then one day I took the time to RTFM and just added this to my ~/.bashrc:
history -r $HOME/.static_bash_history HISTFILE=/dev/null
The first line reads my curated history into the current shell's history, and the second ensures that changes to the history won't go anywhere.
Here are the advantages I gained:
Ctrl+R ffmpeg Enter always runs the same command. This means I can safely memorize fragments of commands and then quickly and safely get to them.Some tips:
Ctrl+R works predictably.echo, so that Up Enter doesn't do something unexpected.PageUp Enter.Some thoughts:
2025-03-11