如何让Bash不记录操作历史

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

阅读 15k
4 个回答

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

ln -s /dev/null  ~/.bash_history

或者

$ unset HISTFILE

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

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
新手上路,请多包涵

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

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题