Linux清除用户登录记录和命令历史方法

<p>清除登陆系统成功的记录</p><pre class="brush:bash;toolbar:false">[root@localhostroot]#echo&gt;/var/log/wtmp#此文件默认打开时乱码,可查到ip等信息 [root@localhostroot]#last#此时即查不到用户登录信息</pre><p>清除登陆系统失败的记录</p><pre class="brush:bash;toolbar:false">[root@localhostroot]#echo&gt;/var/log/btmp#此文件默认打开时乱码,可查到登陆失败信息 [root@localhostroot]#lastb#查不到登陆失败信息</pre><p>清除历史执行命令</p><pre class="brush:bash;toolbar:false">[root@localhostroot]#history-c</pre><p>或者,清空用户目录下的这个文件即可</p><pre class="brush:bash;toolbar:false">[root@localhostroot]#echo&gt;./.bash_history</pre><p>1.vi /root/history #新建记录文件</p><p>2.history -c #清除记录</p><p>3.history -r /root/history.txt #导入记录</p><p>4.history #查询导入结果</p><p>example<br/></p><pre class="brush:bash;toolbar:false">[root@localhostroot]#vi/root/history [root@localhostroot]#history-c [root@localhostroot]#history-r/root/history.txt [root@localhostroot]#history 1echo&gt;/var/log/wtmp 2last 3echo&gt;/var/log/btmp 4lastb 5history-c 6echo&gt;./.bash_history 7history</pre><p></p>
RangeTime:0.011567s
RangeMem:204.79 KB
返回顶部 留言