How to clear command history using Linux history command

Basic Linux Command Example: 

 

How to clear command history using Linux history command.

 

   The Linux command history is a list of Linux command that you execute in or on current shell session.  This list of command history is store inside your home directory, in hidden file called ".bash_history".  The default configuration of command history can store up to 500 entry of your previous executed command.  This list of history command is quite annoying if you want to hide your track or if you want to hide the command entry that you have execute in your shell session.  The example below show how clear command history using history command.

 

Example on How to clear command history.

 

1.  Login on the system and open new shell session.

2.  Execute history command with -c option as show on example below.

clear command history

[linux@fedora11 ~]$ history -c

[linux@fedora11 ~]$

 

3.  Type in history command again to verify that you clear all history command, you should get the output from the history command as show on example below.

clear all history command

[linux@fedora11 ~]$ history

    1  history

[linux@fedora11 ~]$

 

Keywords: clear command history, clear history command, clear history, history command, bash_history