Linux删除 [ history ] 历史命令记录
在
Linux
系统的终端中,会一直保存着命令的执行记录,在共用的服务器环境下,有时候,这些信息不想让其他人知道,我们就需要在操作完成之后去清除这些痕迹。
全部清除
history -c
执行之后,再次敲入
history
,发现已经看打不到之前的命令了,但是,你别以为问题就此解决了,系统中还有一个地方保存着这些记录,~/.bash_history
文件,所以,根除的方法应该是
rm -rf ~/.bash_history
history -c
部分清楚
删除指定行的历史记录
history -d [指定行号]
更多参数
root@hcss-ecs-c875:~/foo# history -h
-bash: history: -h: invalid option
history: usage: history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]
root@hcss-ecs-c875:~/foo#
标题:Linux删除 [ history ] 历史命令记录
作者:llilei
地址:http://solo.llilei.work/articles/2023/10/05/1696516905263.html