【问题标题】:zsh command line history with timestamp带有时间戳的 zsh 命令行历史记录
【发布时间】:2021-09-09 02:10:45
【问题描述】:

我使用的是 zsh 4.3.6。我想在命令行历史记录中有时间戳。 history -i 始终显示当前时间:

> history -i
498  2020-04-27 14:54  history -i
499  2020-04-27 14:54  cat ~/.zsh_history
500  2020-04-27 14:54  exit

$HISTFILE中好像没有保存时​​间戳:

> cat $HISTFILE
ls
zsh --version
history -i

如何获得持久的命令行历史时间戳?

谢谢。

【问题讨论】:

  • 我正在使用 zsh 5.8 (x86_64-debian-linux-gnu) 并且“history -i”返回“fc: event not found: -i”,就像任何其他应该显示日期和时间的开关一样。

标签: command-line zsh


【解决方案1】:
setopt EXTENDED_HISTORY     # puts timestamps in the history

setopt extendedhistory

~/.zshrc

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-04-12
    • 2012-12-11
    • 1970-01-01
    • 2016-11-26
    • 2012-05-26
    • 1970-01-01
    • 2013-01-07
    相关资源
    最近更新 更多