zoukankan      html  css  js  c++  java
  • 查询历史命令,和清除

    history

    清除登陆系统成功的记录
    [root@localhost root]# echo > /var/log/wtmp //此文件默认打开时乱码,可查到ip等信息
    [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]# vi /root/history //新建记录文件
    [root@localhost root]# history -c //清除记录 
    [root@localhost root]# history -r /root/history.txt //导入记录 
    [root@localhost root]# history //查询导入结果
    
    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
  • 相关阅读:
    _MSC_VER
    git之撤销修改
    vi/vim如何添加或删除多行注释
    C++ 读取文件数据和输出数据到文件
    git上传本地单独修改的文件
    Git学习笔记
    C++中类的声明
    linux中ldconfig的使用介绍
    #define 和 typedef 中的##
    find、xargs、grep基本用法
  • 原文地址:https://www.cnblogs.com/gzpu/p/13258441.html
Copyright © 2011-2022 走看看