Search code examples
linuxshellhistorytcsh

how can I filter out same commands in tcsh history


I am using tcsh. But annoyed by same command stored in history file. I have to use multiple times of up arrow to bypass the same command, very inconvenient. Can anyone give some help to solve this inconvenience.


Solution

  • There's the histdup setting for this; from tcsh(1):

       histdup (+)
               Controls handling of duplicate entries in the history list.  If
               set to `all' only unique history events are entered in the
               history list.  If set to `prev' and the last history event is
               the same as the current command, then the current command is
               not entered in the history.  If set to `erase' and the same
               event is found in the history list, that old event gets erased
               and the current one gets inserted.  Note that the `prev' and
               `all' options renumber history events so there are no gaps.