Laravel  
laravel
文档
数据库
架构
入门
php技术
    
Laravelphp
laravel / php / java / vue / mysql / linux / python / javascript / html / css / c++ / c#

linux 清除历史命令

作者:◇梦◆饭饭   发布日期:2026-05-22   浏览:86

# 清除当前终端会话的历史命令
history -c

# 清除历史命令并删除 ~/.bash_history 文件中的记录
history -c && history -w

# 仅清除 ~/.bash_history 文件中的记录,不清除当前会话的历史命令
> ~/.bash_history

解释说明:

  1. history -c:清除当前终端会话中的历史命令。这不会影响 ~/.bash_history 文件中的记录。
  2. history -c && history -w:先清除当前会话的历史命令,然后将当前会话的历史记录写入 ~/.bash_history 文件,实际上清空了该文件的内容。
  3. > ~/.bash_history:直接清空 ~/.bash_history 文件中的所有记录,但不清除当前会话的历史命令。

上一篇:linux查询防火墙

下一篇:linux 查看文件路径

大家都在看

linux如何启动nginx

linux常用命令查询端口是否正常

linux 发送邮件

linux长ping命令

linux groupadd

linux关机命令行

linux 安装 gcc

linux重启oracle命令

linux把一个文件夹移动到另一个文件夹里

linux查看系统运行时间

Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3

Laravel 中文站