xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

How to Safely Clear Shell Command History in Linux All In One

Linux safety clear shell command history All In One

如何在 Linux 中安全地清除 Shell 命令历史记录

history shell command

$ cat ~/.bash_history
# bash ✅
$ history -c

$ cat ~/.zsh_history
# zsh ✅
$ history -p

# 手动删除
$ sudo rm -rf ~/.bash_history

# 使用空白覆盖
$ echo -n > ~/.bash_history
$ echo  > ~/.bash_history

$ echo  "💩" > ~/.bash_history

-n do not output the trailing newline

不要输出尾随的换行符

demos

image

image

(🐞 反爬虫测试!打击盗版⚠️)如果你看到这个信息, 说明这是一篇剽窃的文章,请访问 https://www.cnblogs.com/xgqfrms/ 查看原创文章!

calendly


30 Minute Meeting
30 mins
Time zone: China, Singapore, Perth Change
Friday, April 4
09:00
See all available times

image


https://calendly.com/event_types/user/me

refs

https://unix.stackexchange.com/questions/544373/how-to-clear-history-in-zsh

https://github.com/aplyc1a/blogs/blob/master/取证溯源/Linux取证-(1).md#1-历史记录残余



©xgqfrms 2012-2021

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2025-04-04 00:16  xgqfrms  阅读(23)  评论(1)    收藏  举报