查看linux系统运行时长及重启时间

今早一来,同事就在查一台测试机昨晚异常重启的原因,

遗憾的事IPMI SEL已经写满了,没有记录最后的状况,只能在系统下面查

 

通过last reboot 查询系统的重启情况

[root@test  home]# last reboot

reboot   system boot  2.6.32-279.el6.x Mon Nov  9 11:50 - 08:34 (78+20:57) 
reboot   system boot  2.6.32-279.el6.x Wed Oct 21 12:33 - 08:34 (97+20:01) 
reboot   system boot  2.6.32-279.el6.x Mon Oct  5 08:24 - 12:32 (16+04:07) 
reboot   system boot  2.6.32-279.el6.x Mon Oct  5 08:18 - 08:24  (00:05)   
reboot   system boot  2.6.32-279.el6.x Mon May  4 08:12 - 17:13 (144+09:01)
reboot   system boot  2.6.32-279.el6.x Sat Mar  7 08:09 - 08:06 (57+23:57) 
reboot   system boot  2.6.32-279.el6.x Fri Mar  6 16:03 - 08:08  (16:05)   
reboot   system boot  2.6.32-279.el6.x Thu Feb 26 15:18 - 16:02 (8+00:44)  
reboot   system boot  2.6.32-279.el6.x Thu Feb 26 08:09 - 15:17  (07:08)   
reboot   system boot  2.6.32-279.el6.x Mon Oct 13 09:20 - 17:15 (123+07:54)
reboot   system boot  2.6.32-279.el6.x Sat Oct 11 16:24 - 17:15 (125+00:50)
reboot   system boot  2.6.32-279.el6.x Mon Oct  6 08:13 - 17:15 (130+09:01)
reboot   system boot  2.6.32-279.el6.x Thu Jun  5 08:20 - 17:07 (117+08:46)
reboot   system boot  2.6.32-279.el6.x Wed Jun  4 19:57 - 08:19  (12:22)   
reboot   system boot  2.6.32-279.el6.x Wed Jun  4 19:48 - 19:56  (00:07)   
reboot   system boot  2.6.32-279.el6.x Wed Jun  4 19:28 - 19:48  (00:19)   
reboot   system boot  2.6.32-279.el6.x Wed Jun  4 19:25 - 19:26  (00:01)   

wtmp begins Wed Jun  4 19:25:43 2014

最后一行
wtmp begins Wed Jun  4 19:25:43 2014

说明文件是从2014年1月4日开始生成的,基本上是安装系统的日期

之后一行一行往上看,后面括号里的时间代表系统运行时间(78+20:57)  ,可以看到最近一次已经运行了78天

//-F 参数  Print full times and dates

通过uptime确认一下启动时间,是一致的

[root@test  home]#uptime

08:47:33 up 78 days, 20:57,  3 users,  load average: 0.05, 0.05, 0.00

 

既然说到了这里,那就再找一下与此相关的命令

w 命令  Show who is logged on and what they are doing. //可直接查看up了多久

uptime 命令  Tell how long the system has been running.//可直接查看up了多久

top 命令 display Linux tasks .//可直接查看up了多久

who 命令 show who is logged on //

who -b 查看最后一次系统启动的时间。

         system boot  2015-11-09 11:50

lastb查看失败登录

last命令用了记录成功登录,而 lastb 命令记录失败的登录尝试。

你可能感兴趣的:(linux,System,查询系统)