问题描述
我要执行某些命令,但不希望将它们存储在命令历史记录。所以没有人会能够搜索到它在 .bash_history的
文件。
I want to execute some commands but don't want to store them in the command history. So that nobody will be able to search it in the .bash_history
file.
有什么办法如何执行的bash命令这种方式?
Is there any way how to execute bash commands this way?
推荐答案
以空格开始您的命令,它不会被列入历史。
Start your command with a space and it won't be included in the history.
请注意,这确实需要的环境变量 $ HISTCONTROL
来进行设置。
Be aware that this does require the environment variable $HISTCONTROL
to be set.
-
检查以下命令返回
ignorespace
或ignoreboth
#> echo $HISTCONTROL
要添加如果它丢失的环境变量,下面的行可以
加入的bash轮廓。例如。 %HOME / .bashrc中
export HISTCONTROL=ignorespace
采购再次空间prefixed命令将不会被写入 $ HISTFILE
After sourcing the profile again space prefixed commands will not be written to $HISTFILE
这篇关于没有保持它在历史上执行命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!