Take the 2-minute tour ×

If I type the following:

history -c

I get 1110 history.

Why does clearing the command history not reset the counting to 1 and how can I reset the count?

Note: It is resetting the number, just not to 1. If I type 5 commands, the number changes to 1114 but history -c only resets it to 1110.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

From bash man page:

On startup, the history is initialized from the file named by the variable HISTFILE (default ~/.bash_history)...

When an interactive shell exits, the last $HISTSIZE lines are copied from the history list to $HISTFILE. If the histappend shell option is enabled (see the description of shopt under SHELL BUILTIN COMMANDS below), the lines are appended to the history file, otherwise the history file is overwritten...

So, only on exit the file ~/.bash_history is updated, and if histappend is set, the default, that file is not overwritten.

My suggestion, remove ~/.bash_history, then perform history -c.

share|improve this answer

Your Answer


