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
Asked
Active
Viewed 3,155 times
3
1 Answers
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