avatar

redh's blog

热爱可抵岁月方长

  • 首页
Home linux查询历史命令
文章

linux查询历史命令

Posted 2024-07-25 Updated 2024-07- 25
By redh
1~2 min read

history命令用法汇总

命令用法
history列出全部历史命令
history 数字#列出最近的#条命令
history -c将目前shell中的所有history命令消除【就是按↑翻不到了】,对命令历史文件没有影响
history -w将本次登录的命令写入命令历史文件中, 默认写入~/.bash_history【其实是会自动保存的】
history -r将命令历史文件中的内容读入到目前shell的history记忆中【就是按↑能翻到】

~/.bash_history文件会自动保存当前用户使用过的历史命令

搜索history中包含某些关键词的命令

history | grep 关键词

image-20240725165757871

License:  CC BY 4.0
Share

Further Reading

OLDER

python的Paramiko库总结

NEWER

VMware与主机之间实现文件传递

Recently Updated

  • 路由(flask)
  • json入门
  • ubuntu常用压缩和解压缩命令
  • VMware与主机之间实现文件传递
  • linux查询历史命令

Trending Tags

Halo

Contents

©2025 redh's blog. Some rights reserved.

Using the Halo theme Chirpy