Advanced

How to effectively clear your bash history

Posted by the_doctor on · 3 comments
TechRepublic; By Jack Wallen
Mail this story
Print this story

On your Linux machines, a history of your bash commands is retained. This is great when you need to repeat a command or can't remember exactly how you executed a command in a previous session. However, this can also be seen as a security issue. What if someone gains access to your machine, opens a terminal window, and checks through your bash history to see what commands you've run?

Full Story

  Nav
» Read more about: Story Type: Tutorial; Groups: Developer, Distributions, Linux

» Get new stories by e-mail: nightly or as they are published

« Return to the newswire homepage

  Related stories
» More like this

Comments (3)


rm ~/.bash_history
ln -s /dev/null ~/.bash_history
This will effectively act as a temporary history store for a given terminal or login instance's bash history. However, the history will be 'forgotten' upon exiting the terminal or login.

This trick also works with '~/.local/share/recently-used.xbel'

However, with recently-used... each login will create a new recently-used file which is deleted upon exit or new login ... I forget which.

I think that's right...
Or, in your .bash_profile add the following line:

export HISTFILESIZE=0

This way, shell history is strictly per-process, and never saved/shared.
In Linux/Unix, there are usually half a dozen ways to accomplish the same task.

Did anyone else make their cookies file in Netscape read only to keep it from storing cookies?

Post a comment

A free account is needed to post. Write your comment here first: your text is kept in this browser while you sign up or log in, and is waiting for you when you come back.

Your message:
|||||
10
Markdown: **bold**, *italic*, [text](https://link), - lists, > quotes, $x^2$ for math. Formatting help

Sign up and post (it is free)  or  Log in and post