how to clear command histroy from terminal in linux
- User
how to clear command histroy from terminal in linux
- Assistant
To clear the command history from the terminal in Linux, you can follow these steps:
-
Clear the current session's command history: You can clear the current terminal session's command history by using the following command:
bashhistory -c -
Clear history file: To delete the command history saved in the history file (usually
~/.bash_historyfor bash users), you can use:bash> ~/.bash_historyThis effectively empties the history file.
-
Clear the history in and reload it: After clearing the history file, you may want to ensure that the shell recognizes the change. You can do this by executing:
-