【问题标题】:how to avoid commands whose length less than 5 being written into ~/.bash_history如何避免将长度小于 5 的命令写入 ~/.bash_history
【发布时间】:2014-12-16 03:33:41
【问题描述】:

我知道如何记录我在~/.bash_history 中输入的每个命令:

export PROMPT_COMMAND="history -a"

我的问题是,应用上述技巧后,如何避免将长度小于 5 的命令写入~/.bash_history

【问题讨论】:

  • 体面的问题。但更适合 SuperUser 或可能专注于 Linux 的 Stack Exchange 站点。

标签: linux bash history


【解决方案1】:

您可以使用HISTIGNORE,它采用冒号分隔的模式列表从您的历史记录中省略:

HISTIGNORE='?:??:???:????' # omit 1/2/3/4-char commands from history

把它放在你的~/.bashrc 或类似的地方。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多