开发者

How to browse through probable results of history in Unix shell using CTRL-R?

I have a shell script which I execute frequently in a day with different arguments and/or options each ti开发者_运维知识库me. What I am looking for is a way to "browse through" different executions of this shell script before selecting a particular one through CtrlR facility. How do I do that?

Ofcourse I can type "history" command and browse through the list manually;however I find CtrlR more convinient. :)

--

Ben


Try typing a common prefix and then pressing ctrl-r repeatedly to browse through different executions.

For example, let's say the command is vim, then:

  1. press CTRL-R to begin the reverse-i-search
  2. type vim
  3. press CTRL-R repeatedly to cycle through previous executions


$ history |grep vi
  711  vi file
  748  vi file
  752  vi file

$ !711
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜