Removing Entries from Linux History
Last Updated by Code Sport. Filed under linuxRemoving Entries from the Linux Command Line History File First you can…
First you can avoid have commands saved to the history file by preceding them with a leading space. Here’s an example:
$ nano /path/to/my/file/passwords.txt ^-- additional space character
If there are pre-existing commands that you want removed, just open the history file in nano and delete the entries you want removed. Here’s how you do it:
$ nano ~/.bash_history
Be aware that entries are only committed to the history file when a user exits a log-in session. Hence, to remove entries committed during your current session, log-out and then log-in as the same user.