I have the program hstr installed.

Is there a way to delete all commands from hstr?

Using history -c doesn't affect hstr and I can't find anything in the man to delete more than a single command at a time from hstr. This seems like an oversight, as clearing your entire history seems like a common task.

Is there any way to clear the entire hstr command history?

I also have an additional question when using the normal history command:

When I do history -c the command history is deleted which can be seen by running history again. However, when I open up a new terminal and run history suddenly there are many commands back in my history.

Are the commands being persisted somehow? How do I prevent the commands from re-populating after running history -c?


1 Answer 1


I was able to delete the history with the following command

$ rm ~/.bash_history

After deleting the history, the hstr tool will also have the history cleared. (It shares it's history with the normal history command).

Closing and re-opening a new terminal confirms that the history stays deleted. This can be confirmed by running hstr or history.

Note that the hstr command has no native option to delete all history. It must be deleted using history -c, or, in my case, rm ~/.bash_history since I have persistent history setup between shells and therefore history -c doesn't work.

You can delete hstr entries one by one using the DEL key from within hstr

Note that the bug mentioned in the comment above (https://github.com/dvorka/hstr/issues/386) is not relevant here. I confirmed this bug exists (it's reproducible) but it doesn't relate to my question. The strange part about this bug, is the command referenced in the bug, history -r, is not actually a part of the history command on Debian which is History GNU version 6.3, which the man file can be found here: http://man7.org/linux/man-pages/man3/history.3.html (Note that there is no -r option)

history -r appears to be part of a different version of history, although one which I can not find nor know anything more about. This man file mentioned -r, but it isn't clear what version of history this is for: https://ss64.com/bash/history.html

  • Welcome to the site, and thank you for your contribution. It is perhaps worthwile to note that while deleting the .bash_history does indeed remove the command history "for good", it does not affect commands used in the current bash session, and that these commands will be synced back to that file once the session exits.
    – AdminBee
    Commented Feb 20, 2020 at 12:36
  • 1
    I have updated my answer to be more complete - please let me know if it is sufficient.
    – Nate Houk
    Commented Feb 21, 2020 at 12:17
  • The reference to history(3) is irrelevant as that is about some library implementing history management routines (which bash may use, but that are irrelevant to a user running the command history -r). Just mentioning this as you seem to be confused by the history(3) manual (the history command is documented in the shell's manual).
    – Kusalananda
    Commented Feb 21, 2020 at 12:46
  • But when I type man history I receive the history(3) shown in the terminal. I don't see any man pages that mention -r
    – Nate Houk
    Commented Feb 21, 2020 at 13:54
  • @NateHouk That's because history is a shell built-in command, not an external command with its own manual. See the manual for bash (or for that matter, help history in an interactive bash shell). See also Why don't shell builtins have proper man pages?
    – Kusalananda
    Commented Feb 21, 2020 at 22:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .