Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Under normal circumstances, a command typed in a Terminal/shell can be retrieved later via history command or other means.

Is there any way to have an "incognito" Terminal/shell, i.e. one whose commands are not remembered in any way after it is closed?

One use for this would be to charge a credit card, or perform other security sensitive commands.

A potential answer is to boot a Linux "Live CD" and then shut it down. Any other (easier) approaches that would work in OS X/Linux/Windows?

share|improve this question

You did not specify which shell you are using but:

The HISTFILE environment variable defines where the history is stored. With


you can tell bash to stop recording commands. You can re-enable it with

export HISTFILE=${HOME}/.bash_history

From man bash:

       The name of the file in which command history is saved (see  HISTORY  below).   The  default
       value  is  ~/.bash_history.   If unset, the command history is not saved when an interactive
       shell exits.
share|improve this answer
Is this the only file that keeps any history? If I delete something private from there, can I be sure it won't be anywhere else too? – Dmitri Shuralyov Sep 25 '12 at 19:15
It is the only place where the shell stores the history but if something else (e.g., a backup program) copies the history file somewhere else you will have to delete it also there. – Matteo Sep 26 '12 at 5:09
@Matteo This does not seem to be entirely true. In Mac OSX's Terminal, if I do: unset HISTFILE; sudo echo sensitive_command, then sudo grep -r "[s]ensitive_command" / ... I can see the command in /private/var/log/system.log. – Stephen M. Harris Apr 8 '14 at 22:11
After a bit of testing, only successful sudo commands appear to be logged in /private/var/log/system.log (sudo commands only, even as root user). – Stephen M. Harris Apr 8 '14 at 22:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .