bash 历史 CTRL+R 行为

标签 bash bash-completion

关闭。这个问题是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/

相关文章:

linux - git bash : How to move to a directory

python - 带 shell 完成的 pip install

bash - ZSH 从脚本提示完成(像 BASH 的 read -e)

linux - 从文本文件转换数字

Bash,调用源自脚本的函数?

xcode - faSTLane 无法安装在我的 imac 上

bash - 如何将非拉丁语 gnu/make 目标添加到完成列表?

linux - 我如何让 bash globbing 在脚本中工作

bash - 如何使 bash 完成为 git 别名工作?

bash - 如何完成 rustup/cargo 命令?