如何让Bash不记录操作历史

74次阅读

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

pingouin

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

ln -s /dev/null  ~/.bash_history

或者

$ unset HISTFILE

明城

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

yitype

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

maoniu

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

那个鬼x

正文完