Remove line from history in Linux
1. Find out the line number you want to remove
# history
987 2014-04-07 14:03:19 apachectl stop
988 2014-04-07 14:09:49 apachectl start
989 2014-04-08 13:09:54 apachectl stop
990 2014-04-08 13:11:24 apachectl start
991 2014-04-08 13:11:27 exit
2. Now delete the line from history by command history -d #. Example here I am going to delete line 990
# history -d 990
3. Check the line has been deleted or not
# history
987 2014-04-07 14:03:19 apachectl stop
988 2014-04-07 14:09:49 apachectl start
989 2014-04-08 13:09:54 apachectl stop
990 2014-04-08 13:11:27 exit
991 2014-04-11 17:26:44 history -d 990
992 2014-04-11 17:26:47 history
If you want to use everything from history then use following command:
# history –d