last reboot

[root@servicel02 ~]# last reboot
reboot   system boot  2.6.18-194.el5   Fri Oct  8 18:48         (277+23:46)
reboot   system boot  2.6.18-194.el5   Fri Oct  8 18:27          (00:19)
reboot   system boot  2.6.18-194.el5   Fri Oct  8 18:01          (00:21)
reboot   system boot  2.6.18-194.el5   Fri Oct  8 17:18          (00:40)
reboot   system boot  2.6.18-194.el5   Fri Oct  8 16:42          (00:33)
reboot   system boot  2.6.18-194.el5   Fri Sep 17 11:30         (21+05:01)
reboot   system boot  2.6.18-194.el5   Wed Sep 15 11:11         (2+00:16)
reboot   system boot  2.6.18-194.el5   Wed Sep 15 11:02          (00:06)
reboot   system boot  2.6.18-194.el5   Wed Sep 15 10:52          (00:08)
reboot   system boot  2.6.18-194.el5   Wed Sep 15 10:44          (00:05)

wtmp begins Wed Sep 15 10:44:24 2010
最后一行
wtmp begins Wed Sep 15 10:44:24 2010
这是说/var/log/wtmp这个文件是在2010年9月15日周三上午10:44:24这个时间点生成的,一般来说这就是装系统的时候了。

注意看第一行
reboot   system boot  2.6.18-194.el5   Fri Oct  8 18:48         (277+23:46)
这说明从去年10月8日18:48分到现在,他已经连续战斗了将近278天了

最后咱们用uptime命令来验证一下

代码:

uptime
18:49:25 up 278 days, 1 min,  1 user,  load average: 0.07, 0.02, 0.00

呵呵278天零1分钟了

LZ应该明白了吧~~别怕last里的reboot多,主要看第一行的最后那个数字。写个简单的正则命令就明白了

last reboot -1 |awk '{print $NF}'
(278+00:02)

2010

怎么样,大家都来秀一下last reboot -1 |awk '{print $NF}' 啊哈哈~~~~~

点赞

发表回复

电子邮件地址不会被公开。必填项已用 * 标注