How to exclude some commands from being stored in TCSH history

command historytcsh

I store my commandline history in TCSH, but I want to prevent certain frequent, simple commands like "exit", "cd" to be included in the history (the history holds only a fixed number of commands, so I want to retain only the useful commands).

Is there a way to specify an "exclusion list" – a list that will contain commands that would not be added in the current history file ? That way, I can keep only the most relevant commands in history and filter out the ones I don't want to clog the history.

Best Answer

It's not exactly what you want, but this may help:

  histdup (+)
    Controls handling of duplicate entries in the history list.  If set to `all' only unique his-
    tory  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.

So you put a 'set histdup = all' in your .tcshrc, and while you will still get trivial commands in your history, you will only get one instance of each, which at least reduces the clutter.