11 月 282012
 

查看系统登录成功记录
#last
查看最后两笔登录记录
#last -n 2
查看指定用户的登录记录
#last oracle
oracle pts/0 :0.0 Thu Nov 22 08:53 still logged in
oracle pts/1 :0.0 Tue Nov 20 17:39 still logged in
oracle tty1 :0 Tue Nov 20 17:26 still logged in

清空登录日志文件(特殊编码)
[root@localhost root]# echo “”>/var/log/wtmp

再次查看系统登录记录
[root@localhost root]# last

查看系统登录失败记录
#lastb
root ssh:notty 192.168.1.50 Tue Nov 27 20:21 – 20:21 (00:00)
root ssh:notty 192.168.1.50 Tue Nov 27 20:20 – 20:20 (00:00)
root ssh:notty 192.168.1.50 Mon Nov 26 11:09 – 11:09 (00:00)
root ssh:notty 192.168.1.50 Tue Nov 20 17:11 – 17:11 (00:00)

清空登录系统失败记录(特殊编码)
# echo “”> /var/log/btmp
再次查看系统登录失败记录
# lastb

清空历史命令记录
[root@localhost root]# history -c

[root@localhost root]# echo “”> .bash_history

查看指定数量的最近命令记录
[root@oracle ~]# history 3
10 history
11 cat .bash_history
12 history 3
使用命令记录编号重复执行命令
[root@oracle ~]# !11
cat .bash_history
执行最后一次以tar起始的命令
[root@oracle ~]# tar xzf awstats-7.0.tar.gz
[root@oracle ~]# rm -rf awstats-7.0
[root@oracle ~]# !tar
tar xzf awstats-7.0.tar.gz
[root@oracle ~]#

历史命令记录数量控制
#env |grep HISTSIZE
HISTSIZE=1000

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据