How To Delete or Clear Linux Comand Line History

You may want to clear the history file and the screen for the security reason. Some Linux distributions may clear the screen but others do not clear the screen when you logout. Many programs read input as a single line at a time. The GNU history library is able to keep track of those lines, associate arbitrary data with each line, and utilize information from previous lines in composing new ones. Bash and other shell may use this history library.
The default fie is ~/.history or ~/.bash_history.

History can be reset by appending following commands.

From above listed commands first one will clear bash history and second one will clear mysql command history using redirection operator ‘>’.
I’m using CentOS Linux server and how do I clear bash history in UNIX / Linux / BSD operating systems?
You can set another option to clear the history. Set the link ~/.bash_history to /dev/null:

#ln -sf /dev/null ~/.bash_history
You can also use history command to clear histroy.The -c option causes the history list to be cleared by deleting all of the entries.
$ history -c
The option –d is also used to clear history.This will delete the history entry at position offset.
# history -d offset
# history
1 cd
2 history
3 ls -alhF
4 history
5 wget
6 mkdir
Now if you want to delete the mkdir command just use:
# history -d 5
# history
1 cd
2 history
3 ls -alhF
4 history
5 wget
6 history
7 history –d 6

Stop writing to .bash_history

You can stop logging of history using one of the two ways: turn it off for all users, or turn off logging history for a single user.

Turn off bash history for all users

# echo “unset HISTFILE” >> /etc/profile

Turn off bash history for a specific user

# echo “unset HISTFILE” >> /home/USER/.bash_profile

Anther method is set below parameters to zero.

You can edit your .bashrc and add
Now you can successfully delete the bash history and even stopped logging to bash history using any of the above listed commands.