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>

分类

  1. linux
  2. centos

按月统计

  1. 2021-12 (201)
  2. 2022-02 (3)
  3. 2022-03 (1)
  4. 2023-05 (4)
  5. 2023-06 (64)
  6. 2023-07 (30)
  7. 2023-09 (1)
RangeTime:0.024726s
RangeMem:207.69 KB
返回顶部 留言