“If something isn't easy to understand,
it just has to be explained in a different way ...”

Blog - page 2

How you delete commandlines from the bash history

And suddenly it happened again: I’ve typed sensitive information - at this time it was a password - into the commandline.

And the shell kindly saved the typed commandline into it’s history. This way it want’s to help me, if I need the same commandline again.

But what happens, if the system I’ve worked on isn’t under my full control (a customer system)? Or what if someone later looks over my shoulder, while I’m searching my history for an other command?

The sensitive line needs to be removed.

  • what’s the best way to do this?
  • How do we save us from doing this again at some time in the future?

Generally you have two ways to remove commanlines from the bash-history: by using the history command or by editing ~/.bash_history directly.

read more »