查看linux系統運行時長及重啓時間

今早一來,同事就在查一臺測試機昨晚異常重啓的緣由,ide

遺憾的是IPMI SEL已經寫滿了,沒有記錄最後的情況,只能在系統下面查測試

 

經過last reboot 查詢系統的重啓狀況it

[root@test  home]# last rebootast

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)    class

wtmp begins Wed Jun  4 19:25:43 2014test

最後一行
wtmp begins Wed Jun  4 19:25:43 2014 登錄

說明文件是從2014年1月4日開始生成的,基本上是安裝系統的日期date

以後一行一行往上看,後面括號裏的時間表明系統運行時間(78+20:57)  ,能夠看到最近一次已經運行了78天im

//-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 命令記錄失敗的登陸嘗試。

相關文章
相關標籤/搜索