如何删除Shell中最近10条命令的历史记录? [英] How to delete history of last 10 commands in shell?
本文介绍了如何删除Shell中最近10条命令的历史记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
遵循命令
511 clear
512 history
513 history -d 505
514 history
515 history -d 507 510 513
516 history
517 history -d 509
518 history
519 history -d 511
520 history
我可以通过history -d 511
删除单个命令,但是如何在shell中使用单个命令删除最后10个命令以及10个命令之间的历史记录呢?
I can delete single one by history -d 511
, but how to delete last 10 commands and in between 10 commands history using single command in shell?
我们可以编写一个bash脚本并执行以删除历史记录吗?
Can we write a bash script and execute for deletion of history?
推荐答案
您是否尝试过直接编辑历史记录文件:
Have you tried editing the history file directly:
~/.bash_history
这篇关于如何删除Shell中最近10条命令的历史记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文