【发布时间】:2015-01-06 22:19:32
【问题描述】:
当我在 Bash 中运行 history 时,我得到了大量结果 (1000+)。但是,当我运行history zsh shell 时,我只得到 15 个结果。这使得 zsh 中的 grepping 历史几乎毫无用处。
我的.zshrc 文件包含以下几行:
HISTFILE=~/.zhistory
HISTSIZE=SAVEHIST=10000
setopt sharehistory
setopt extendedhistory
如何修复 zsh 以使我的 shell 历史记录更有用?
更新
如果在 zsh 中调用 history 1,我将获得所有历史记录,就像在 Bash 中调用 history 一样。我可以为命令设置别名以获得相同的结果,但我想知道为什么 history 在 zsh 和 Bash 中的行为不同。
【问题讨论】:
-
作为 grepping 历史记录的替代方法,我强烈推荐 fzf (github.com/junegunn/fzf) - 它允许在 ctrl+r 上的 shell 历史记录中进行模糊搜索。
-
简洁明了。感谢您提出问题并提供明确的答案!