3

How to clear the history of recent commands in terminal so that I am unable to scroll through them with up and down arrow keys? Closing and reopening the terminal doesn't seem to clear the history. Nor does the reset command

muru
  • 197,895
  • 55
  • 485
  • 740
Raw N
  • 131

1 Answers1

5

In case of bash you could simply delete the content of ~/.bash_history.

The following should do it:

> ~/.bash_history
dufte
  • 13,272
  • 5
  • 39
  • 43
  • This only clears old history, commands from previous sessions. It doesn't clear "recent" history - commands that have been entered this session. – Zim Jan 24 '20 at 17:29
  • The history -c command clears the current history, but any new bash session will have the old history. Removing the bash_history file was a much better solution. – gaccardo Aug 06 '21 at 13:22