开发者社区 问答 正文

Linux基本命令中 history命令如何使用 HISTIGNORE 忽略历史中的特定命令?

已解决

Linux基本命令中 history命令如何使用 HISTIGNORE 忽略历史中的特定命令?

展开
收起
去校区学技术 2022-04-02 14:25:29 899 分享 版权
1 条回答
写回答
取消 提交回答
  • 推荐回答

    下面的例子,将忽略 pwd、ls、ls -ltr 等命令:

    # export HISTIGNORE=”pwd:ls:ls -ltr:”
    # pwd
    # ls
    # ls -ltr
    # service httpd stop
    # history | tail -3
    79 export HISTIGNORE=”pwd:ls:ls -ltr:”
    80 service httpd stop
    81 history
    [Note that history did not record pwd, ls and ls -ltr]
    
    
    2022-04-02 16:14:22
    赞同 展开评论