|  About Me  |  Blogs  |  Photos  |  Publications  |  Resume  | 

No duplicates in bash history

We can use a bash variable HISTCONTROL to turn off duplicates in bash history. It can be one of three values:

  • HISTCONTROL='ignoreups' means to not enter lines which match the last entered line
  • HISTCONTROL='ignorespace' means to not enter lines which begin with a space or tab into the history list
  • HISTCONTROL='ignoreboth' does both

We can export it in bashrc

export HISTCONTROL='ignoreboth';

One Response to “No duplicates in bash history”

  1. Anonymous Says:

    HISTCONTROL value should be ‘ignoredups’ not ‘ignoreups’

Leave a Reply

You must be logged in to post a comment.