Posts

Showing posts from July, 2016

Preventing bash commands to be displayed in the history or deleting a specific command from history

It's sometimes useful when using the linux command line to prevent things to go into the bash history; for example if you're using curl to download a file while providing your username password.This can be easily done in linux by configuring the HISTCONTROL variable in either your ~/.bashrc (which I recommend in order to have it permanently in your bash sessions) or by just changing the value for your current session. Either way either set the variable as follows on your ~/.bashrc or on your current session HISTCONTROL=ignorespace If you took the ~/.bashrc approach don't forget to source it to have i Once this is done commands that you start with a white space will be ignored : [root@myserver] curl -o strx25.tar.bz2 --user user:password http://www.openss7.org/repos/tarballs/strx25-0.9.2.1.tar.bz2 note the whitespace before the curl commandRemoving a specific line from historyNow if you have to remove a specific line from history this is done in 2 steps Display commands…