Temporary Disabling Bash History
If you want
to disable the bash history temporarily or you want to hide some commands, you
can use unset HISTFILE command.
[root@linux1
~]# unset HISTFILE
The result
is that while the session is active you can access the history as usual, but it
won’t be saved to the disk. As soon as you exit the session, history will be
clear for that particular session only. History for other sessions, will behave
as usual.
609
history
610
unset HISTFILE
611
more /etc/passwd |grep splunk
612
chage -l splunk
613
history
614
date
615
history
[root@linux1
~]#
Exit from
the session and login again - use history command to verify:
609 history
[root@linux1
~]#
Note: below command will same as unset HISTFILE command
[root@linux1
~]# HISTFILE=/dev/null
Location of
history file.
# echo
$HISTFILE
HISTSIZE is the number of lines or
commands that are stored in memory in a history list while your bash session is
ongoing.
HISTFILESIZE is the number of lines or commands
that (a) are allowed in the history file at startup time of a session, and (b)
are stored in the history file at the end of your bash session for use in
future sessions.
# echo
$HISTSIZE
# echo
$HISTFILESIZE
# history
-c