1

How can I prevent Bash from writing history entries to disk? My ~/.bashrccontains the line

trap 'unset HISTFILE; exit' SIGHUP

but it doesn't have the desired effect. If I run history -c && history -w; exit and open a new terminal, the history is empty, but if I type some more commands and exit, the commands are in the history when I open a new terminal. Any ideas?

1 Answers1

4

Put the following line in your ~/.bashrc:

unset HISTFILE

HISTFILE - The name of the file in which command history is saved. The default value is ~/.bash_history. If unset, the command history is not saved when a shell exits.

HISTFILE= works too.

Evgeny
  • 5,476