It depends from the shell you are using. From the command you give it seems you are working with a bash shell. In this case you can both use
HISTSIZE=0
or
HISTFILE=
With the first one (HISTSIZE=
) you put to zero the size of the history for the current shell. This means that after this command you will have no answer from history
or pushing UP, CTRL+R... You can use HISTSIZE=0; exit
to exit from the shell and clean the history of the current shell.
With the second one (HISTFILE=
), a little shorter than all his variants (HISTFILE=/dev/null
, unset HISTFILE
... ), you will continue to have the history available in the current shell but it will not recordered when you will exit.
The built-in help history
propose even
-c clear the history list by deleting all of the entries
In case you are using a zsh shell you can see this answer and the solution proposed.
clearing my terminal history
? Why don't you want to have a history?