a blog about technology, business, and whatever I feel like writing about.
27 Jul
Here is a quick little hack that I figured out in order to selectively exclude a specific command from my bash history.
First, you need to set the HISTCONTROL variable to ignore spaces. You can do this my typing the following command:
export HISTCONTROL=ignorespace
You will then need to restart your bash session. You can confirm that this change took place by typing “env | grep HIST” (without the quotes).
You have now told bash to exclude any command that begins with a space from the history file. So now, whenever you want to perform a command but exclude it from history, simply hit the space bar before typing the command. The command will run just like normal, but you will not find it in your bash history.
Pretty cool, huh?
