In some cases (some bash versions), doing a:
$ history -c; history -w
$ history -cw
Will clear history in memory (up and down arrow will have no commands to list) and then write that to the
$HISTFILE file (if the
$HISTFILE gets truncated by the running bash instance).
Sometimes bash choose to not truncate the
$HISTFILE file even with
histappend option unset and
$HISFILEZIZE set to 0.
In such cases, the nuke option always works:
history -c; >$HISTFILE
That clear the history list of commands recorded in memory and all commands previously recorded to file. That will ensure that the running shell has no recorded history either in memory or disk, however, other running instances of bash (where history is active) may have a full copy of commands read from
$HISTFILE when bash was started (or when a
history -r is executed).
If it is also required that nothing else (no new commands) of the present session would be written to the history file, then,
unset HISTFILE will prevent any such logging.