linux删除history记录

参考网址:

https://blog.csdn.net/Abysscarry/article/details/79700293?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522164560805516780264015079%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=164560805516780264015079&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2allfirst_rank_ecpm_v1~rank_v31_ecpm-2-79700293.pc_search_result_cache&utm_term=centos7%E5%88%A0%E9%99%A4%E6%8C%87%E5%AE%9Ahistory%E5%91%BD%E4%BB%A4&spm=1018.2226.3001.4187

查看命令帮助

help history

[root@VM-0-15-centos ~]# help history
history: history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg…]
Display or manipulate the history list.

Display the history list with line numbers, prefixing each modified
entry with a `*'.  An argument of N lists only the last N entries.Options:-c  clear the history list by deleting all of the entries-d offset  delete the history entry at offset OFFSET.-a    append history lines from this session to the history file-n    read all history lines not already read from the history file-r read the history file and append the contents to the historylist-w  write the current history to the history fileand append them to the history list-p  perform history expansion on each ARG and display the resultwithout storing it in the history list-s    append the ARGs to the history list as a single entryIf FILENAME is given, it is used as the history file.  Otherwise,
if $HISTFILE has a value, that is used, else ~/.bash_history.If the $HISTTIMEFORMAT variable is set and not null, its value is used
as a format string for strftime(3) to print the time stamp associated
with each displayed history entry.  No time stamps are printed otherwise.Exit Status:
Returns success unless an invalid option is given or an error occurs.

全部清除命令

history -c

说明:

一般我们已知的是history -c 命令,即清除所有历史记录
但是如果服务器用的是公司的,就不好执行这种粗暴的操作了。。

部分删除操作

1.*vim ~/.bash_history*
该文件即为历史记录存储文件,我们随意修改

2.修改后再次 history 查看,发现并没有变化。原因:缓存
执行:*history -r*
读取历史文件并将其内容添加到历史记录中,即重置文件里的内容到内存中,完成修改!

linux删除history记录相关推荐

  1. linux执行命令带时间戳,Linux查看History记录加时间戳的小技巧

    Linux查看History记录加时间戳小技巧 熟悉bash的都一定知道使用history可以输出你曾经输入过的历史命令,例如[root@servyou_web ~]# history | more ...

  2. Linux删除history历史命令记录

    有时在系统中登录数据库时不小心明文输入了密码,为了保护隐私,需要将部分或者全部历史记录删除. 删除全部历史记录 history -c 不过在大多数情况下只需要清除部分命令即可 方法1.直接修改历史记录 ...

  3. Linux 中多终端同步 history 记录

    很多文章都是第一时间在语雀进行了更新和发布,公众号的文章只是在语雀平台的基础上进行同步的,而且更新频率也会比语雀要慢.最近弃坑简书,入驻语雀,欢迎阅读原文来语雀一起交流学习. 基本认识 Linux 默 ...

  4. linux设置历史命令行数,Linux设置history命令显示行数以及时间

    Linux和unix上都提供了history命令,可以查询以前执行的命令历史记录 但是,这个记录并不包含时间项目 因此只能看到命令,但是不知道什么时间执行的 如何让history记录时间呢? 解决方案 ...

  5. [20190130]删除tab$记录的恢复2.txt

    [20190130]删除tab$记录的恢复2.txt --//前面链接写好了脚本,开始测试删除后的恢复.千万不要在生产系统做这样的测试!! --//参考链接:http://blog.itpub.net ...

  6. Linux下history命令详解---转载

    Linux下History命令主要用于显示历史指令记录内容, 下达历史纪录中的指令 . >History命令语法: [www.linuxidc.com@linux]# history [n] [ ...

  7. js删除mysql记录_(DELETEUPDATE)修改、删除数据记录_MySQL

    有时,希望除去某些记录或更改它们的内容.DELETE 和 UPDATE 语句令我们能做到这一点. 用update修改记录 UPDATE tbl_name SET 要更改的列 WHERE 要更新的记录 ...

  8. 清楚linux缓存文件,Linux删除文件 清除缓存

    相信很多测试 经常会经历开发叫你清除缓存这种事. 那我们要怎么清呢? 一.首先,确认你要清除的缓存在哪个目录下,然后切换到该目录下,比如 我现在知道我的的缓存目录是在newerp这个目录下,则如图 二 ...

  9. Linux导出history命令到本地

    思路: 找到history记录的文件位置并复制一份 把复制的那一份发送回本地 一.... Linux的history会显示历史代码的记录,想要查到对应的文件位置,可以通过: cd ~ ls -a 然后 ...

最新文章

  1. 站在巨人的肩膀上“思考”问题,重在思考而不是拿来主义
  2. 笔记 - ES6 - 学前浅析
  3. ElasticSearch Groovy脚本远程代码执行漏洞
  4. 【c++】24.std::function和std::bind详解
  5. 需求又变了,要不要怼回去?
  6. 垂直居中相关知识总结
  7. android 可行性分析,可行性研究项目分析程序与步骤
  8. Linux安装BerkleyDB
  9. Android 8.0 学习(24)---Android8.0 WiFi热点适配
  10. 动态链接库、名字修饰约定、调用约定
  11. TreeLSTM Sentiment Classification
  12. lisp封装为vlx方法_LSP FAS VLX 文件自动加载方法
  13. 用DEV-C++写一个走迷宫小游戏1.2最终版(完结,撒花)
  14. python课程结课感悟_关于python课程的感想
  15. 少时诵诗书所所所所所所所所所所所所所所所
  16. Android开源项目分类
  17. 查看电脑当前使用的壁纸
  18. 大数据商机VS个人隐私 车联网的攻与守
  19. Tensorflow五种花卉分类
  20. springboot处理put请求

热门文章

  1. keep-alive 介绍
  2. @RequestMapping与@GetMapping
  3. webpack HMR
  4. 在Windows10中安装Oracle 11g R2
  5. Acwing 1126. 最小花费【图论、单源最短路】
  6. 【图像分割】基于均值聚类+OUST+区域生长法实现MRI图像分割附matlab代码
  7. java中excel文件上传
  8. python函数定义与调用
  9. java JUC基础学习
  10. 调度算法-时间片轮转