# 清除当前终端会话的历史命令
history -c
# 清除历史命令并删除 ~/.bash_history 文件中的记录
history -c && history -w
# 仅清除 ~/.bash_history 文件中的记录,不清除当前会话的历史命令
> ~/.bash_history
history -c:清除当前终端会话中的历史命令。这不会影响 ~/.bash_history 文件中的记录。history -c && history -w:先清除当前会话的历史命令,然后将当前会话的历史记录写入 ~/.bash_history 文件,实际上清空了该文件的内容。> ~/.bash_history:直接清空 ~/.bash_history 文件中的所有记录,但不清除当前会话的历史命令。上一篇:linux查询防火墙
下一篇:linux 查看文件路径
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站