Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

You did not specify which shell you are using but:

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

unset HISTFILE

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

export HISTFILE=${HOME}/.bash_history

From man bash:

HISTFILE
       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
1  
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. –  smhmic Apr 8 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). –  smhmic Apr 8 at 22:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.