How to clear User Logon records and command history using CentOS
Clear the system logon success record [root @ localhost root] # echo>/var/log/wtmp // garbled characters when this file is opened by default, ip address and other information can be found [root @ localhost root] # last // user logon information cannot be found at this time
Clear [root @ localhost root] # echo>/var/log/btmp // garbled characters when this file is opened by default, you can find the logon Failure Information [root @ localhost root] # lastb // you cannot find the logon Failure Information. Clear the historical execution command [root @ localhost root] # history-c // clear the historical execution command [root @ localhost root] # echo>. /. bash_history // or clear the file in the user directory.Import an empty history record [root @ localhost root] # vi/root/history // create a record file [root @ localhost root] # history-c // clear the record [root @ localhost root] # history-r/root/history.txt // Import Record [root @ localhost root] # history // query the import result
Example [root @ localhost root] # vi/root/history [root @ localhost root] # history-c [root @ localhost root] # history-r/root/history.txt [root @ localhost root] # history [root @ localhost root] # echo>/var/log/wtmp [root @ localhost root] # last [root @ localhost root] # echo>/var/ log/btmp [root @ localhost root] # lastb [root @ localhost root] # history-c [root @ localhost root] # echo>. /. bash_history [root @ localhost root] # history