例如:
[root@ip-10-0-7-125 ~]# history | grep free
594 free -m
634 free -m | xargs | awk '{print "free/total memory" $17 " / " $ 8}'
635 free -m
636 free -m | xargs | awk '{print "free/total memory" $9 " / " $ 10}'
736 df -h | xargs | awk '{print "free/total disk: " $11 " / " $9}'
740 df -h | xargs | awk '{print "free/total disk: " $11 " / " $8}'
741 free -m …Run Code Online (Sandbox Code Playgroud) Bash 提供了通过Ctrl+反向搜索的功能R。然后可以在命令它会显示从历史拟合项的部分类型。
假设这是我的历史:
vim foo1
vim foo2 # I want to go here
vim foo3 # this is where I land, how to go back?
Run Code Online (Sandbox Code Playgroud)
我搜索foo. 再次点击Ctrl+R显示下一个合适的搜索条目。经常发生在我身上,我速度太快,导航超过我的预期结果并vim foo3显示出来,现在我想回到vim foo2.
因此我的问题是:如何在反向搜索中导航?