Depends on the shell. In Bash, you can control the history in a couple of ways:
Disable saving history using
set +o history and re-enable it with
set -o history (note the inverted plus and minus). With history disabled, commands entered will not be saved in the history log, but previous ones will be available.
Set the file used to save the history, by setting
HISTFILE=~/somehistoryfile). You can disable it completely by unsetting the variable with
unset HISTFILE. If you disable the history file, you still have access to run-time history while the shell is running. You can also set
HISTFILESIZE to control the amount of commands saved in the file.
Prevent saving certain commands in the history by using
ignorespace will tell the shell to not save command lines starting with a space.
HISTIGNORE can contain patterns of commands not to save in the history. e.g.
HISTIGNORE='ls:ls *' would prevent saving lines that contain only
ls, a space and anything after that.
For an "amnesiac" shell, you would need to apply one of those settings either manually when opening the shell, or set them in some shell startup script.
One option would be to create, say
# include the standard startup files as --rcfile will override them
if [ -f /etc/bash.bashrc ] ; then
if [ -f ~/.bashrc ] ; then
# disable history completely
# disable the history file
# we could even set a reminder in the prompt
and then arrange the shell to be started with
bash --rcfile ~/.bashrc.nohist. Adjust the script to taste.