目录

工欲善其事

实践出真知

活跃标签: linux java mysql 待分类 windows js win10 springboot pdf idea docker 电路 esp32 vue macOS nginx git Arduino maven ffmpeg

存档:

X

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