加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Bash历史重新运行:可能的命令,以避免使用!爆炸!?

发布时间:2020-12-15 22:11:33 所属栏目:安全 来源:网络整理
导读:场景: 你正在做你的每日Bash shell的东西.您想要运行上一个命令,因此键入: history | grep foocommand 然后你会得到一个列表,列出你所做的所有foocommand的东西,无论你的历史记录有多长,你都会在这样的列表中找到: 585 foocommand --baz --bleet 750 fooc
场景:

你正在做你的每日Bash shell的东西.您想要运行上一个命令,因此键入:

history | grep foocommand

然后你会得到一个列表,列出你所做的所有foocommand的东西,无论你的历史记录有多长,你都会在这样的列表中找到:

585 foocommand --baz --bleet
  750 foocommand | grep quux
  987 history grep | foocommand

您决定要运行命令585,因此键入

!585

问题:只是出于好奇,有没有办法让最后一步走出这个等式并仍然得到预期的结果?如果有办法说出来会很好:

"grep through history and automatically run the first item on the list"

要么

"grep through history and let me choose which item to run using the arrow keys"

解决方法

按^ r(即CTLR-r),键入foocommand按Enter;) 这将搜索历史记录并显示最新的匹配条目

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读