Deleting bash (Konsole) history


this isn’t a question but a warning with a possible answer.
Yesterday evening I had some houseworking task to do on my system. As it was late I typed in more or less blindly and quickly (into the Konsole terminal):

su -
followed by enter and the root password and enter again.

Unfortunately, I didn’t really watch what I was doing and I didn’t really hit the enter key after the “su -” command.

So what I actually typed in was “su - <root_password>” and enter.
Logically, the system told me that user “<root_password>” doesn’t exist.

The problem with this was though, that the <root_password> was now visible on my screen - and, more annoyingly, I could call up this line with the “up” keystroke, which brings up the history of lines typed into Konsole.

So anyone with access to the machine could have checked the bash history and gotten at my root password.

The only way to stop this I could find was to delete (or edit) the ~/.bash_history file in my home directory…
(editing may be hte better choice, perhaps the file gets totally overwritten on the disk, though I’m not sure).

I thought I’d share this little mishap.


history -c

and then perhaps also remove the history file, in case it was already committed to disk.

Yes, thanks, that’s indeed what I did.


The same tip applies to .mysql_history. I regularly edit both of them to remove everything except a handful of commonly used commands which I can recall using the up arrow key.