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 2,973 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
- 12,772
- 5
- 38
- 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