How to clear bash command line history

Bash keeps the history of commands that executed and the user can re-execute it using up and down arrows.

All these records are saved to the file ".bash_history" under the home directory of corresponding user.

To remove a particular line from the history file, we can use the following command.

#history -d NUM

Where NUM need to be replaced with the corresponding line number.

To delete or clear all the entries from bash history, we can use the following command.

#history -c

That's all…