sometimes for server security, to prevent others from prying into the commands we enter, we can clear the history, and more often we choose to force history to not remember the command when entering special commands. Experimental method: Execute the Export histcontrol=ignorespace command first, then output Ls-tra, PWD and service mysqld Start command, when the third command is executed, we choose not to remember the command.
[[Email Protected]_96_242_centos ~]#Export Histcontrol=ignorespace
[[Email Protected]_96_242_centos ~]#ls-ltr
Total 168
-rw-r--r--1 root root 5520 Dec install.log.syslog
-rw-r--r--1 root root 12754 Dec install.log
-rw-------1 root root 2005 Dec anaconda-ks.cfg
-rw-r--r--1 root root 9 21:11 a.txt
[[Email Protected]_96_242_centos ~]#pwd
[[Email Protected]_96_242_centos ~]#Service mysqld Start(Note that this command is preceded by a space)
then we'll check the history.
[[Email Protected]_96_242_centos ~]#History |tail-3
844 2016-12-12 17:01:55 ls-ltr
845 2016-12-12 17:01:59 pwd
846 2016-12-12 17:02:36 history |tail-3
is not found we just executed, service mysqld Start No more
Note: If you don't want the history to remember which command, just add a space when you execute the command.
Of course one day you want to empty all history commands can be executed:
[[Email Protected]_96_242_centos ~]#history-c//Clear All records
[[Email Protected]_96_242_centos ~]# history//See if it is emptied
1 2016-12-12 17:12:12 History
[[Email Protected]_96_242_centos ~]#
This article is from the "Xin Stretch" blog, please be sure to keep this source http://xinsz08.blog.51cto.com/10565212/1882015
How to make a history record do not log sensitive commands