200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > Linux清除用户登录记录和命令历史方法(个人笔记)

Linux清除用户登录记录和命令历史方法(个人笔记)

时间:2021-06-01 08:34:54

相关推荐

Linux清除用户登录记录和命令历史方法(个人笔记)

清除登陆系统成功的记录

[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

echo > /var/log/wtmp

last

echo > /var/log/btmp

history -c

echo > ./.bash_history

vi /root/history

history -c

history -r /root/history.txt

history -cw

查询linux服务器有哪些IP在连接

netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

敲一下w,即可看到当前在线人数

# w

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。