首页 > 如何让Bash不记录操作历史

如何让Bash不记录操作历史

终端运行每个命令都会记录下来,每次运行以后,运行history都能看到运行记录。
能不能不要让终端记录的操作。


if grep "unset HISTFILE" /etc/profile >/dev/null 2>&1
        then
            find / -iname '*.bash_history' -type f -exec rm -f {} \;
        else
            echo "unset HISTFILE" >> /etc/profile
            find / -iname '*.bash_history' -type f -exec rm -f {} \;
        fi

有很多方法,我知道的比较方便的有

ln -s /dev/null  ~/.bash_history

或者

$ unset HISTFILE

修改 /etc/profile 文件中的 HISTSIZE=1000 ,将1000改为0


哪条命令不想被记录就在在敲打的命令前加一个空格

【热门文章】
【热门文章】