How to Stop Commands from Appearing in Bash History
I usually don't want my secrets to show up in my bash history in the $HOME/.bash_history
file. Long ago, folks told me that using a trailing space will solve this issue, but it didn't. Apparently, there's some extra stuff to do
Just do
HISTCONTROL=ignoreboth
The above also helps with getting rid of duplicate commands from the bash history, which is pretty cool ๐๐๐ since I use fzf
https://github.com/junegunn/fzf to search through my history and choose commands, and when I search through a command with some strings, sometimes same result shows up multiple times - so many times that it's crazy and I just wish it just showed one unique result and get rid of duplicates, now this is possible because fzf
looks at my $HOME/.bash_history
only to look at all my past commands and if the bash history file contains unique commands, all is good, right? ;) By the way, I use fzf
as part of my Ctrl + r
keybinding for reverse search over all commands.
fzf
has so many ideas for keybindings themselves - https://github.com/junegunn/fzf?tab=readme-ov-file#key-bindings-for-command-line , apart from community's ideas ๐ก๐
Subscribe to my newsletter
Read articles from Karuppiah Natarajan directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Karuppiah Natarajan
Karuppiah Natarajan
I like learning new stuff - anything, including technology. I love tinkering with new tools, systems and services, especially open source projects