关闭。这个问题是off-topic .它目前不接受答案。
想改善这个问题吗? Update the question所以它是 on-topic对于堆栈溢出。
9年前关闭。
Improve this question
有时我尝试通过 CTRL+R 搜索某些命令,但没有找到,
而我最近使用它或按 CTRL+R 搜索成功。
在我运行“历史记录”之后,我可以再次找到该命令。
这种行为正常吗?
如何更改?
最佳答案
Ctrl+R 从历史记录中的当前位置向后搜索,因此如果您已经移动了该位置,您将错过最后的部分。
例如。:
themel@kallisti: ~ $ foob
bash: foob: command not found
themel@kallisti: ~ $ barz
bash: barz: command not found
themel@kallisti: ~ $ barq
bash: barq: command not found
themel@kallisti: ~ $ quarg
bash: quarg: command not found
Ctrl+R,bar 产生:
(reverse-i-search)`bar': barq
但也会移动到历史上的那个点 - 如果您随后按 Ctrl+R 并搜索
quarg
,你不会找到的。这是通过使用 end-of-history
修复的重置。 (M-> 默认) 重新设置索引。
关于bash 历史 CTRL+R 行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12257248/