Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.