查看linux系统的开机时间/重启历史记录
1、who -b命令
[root@rusky opt]# who -b ---查看最后一次(上次)系统启动的时间
system boot Dec 27 05:06
2、who -r命令
[root@rusky opt]# who -r ---查看最后一次(上次)系统启动的时间,及运行级别
run-level 5 Dec 27 05:06
3、last reboot命令
[root@rusky opt]# last reboot
reboot system boot 2.6.-.el6.x Sat Dec : - : (+:)
reboot system boot 2.6.-.el6.x Wed Nov : - : (+:)
reboot system boot 2.6.-.el6.x Mon Oct : - : (+:)
reboot system boot 2.6.-.el6.x Sat Oct : - : (+:)
reboot system boot 2.6.-.el6.x Thu Oct : - : (+:)
reboot system boot 2.6.-.el6.x Wed Oct : - : (:)
reboot system boot 2.6.-.el6.x Wed Oct : - : (:)
reboot system boot 2.6.-.el6.x Wed Oct : - : (:)
reboot system boot 2.6.-.el6.x Wed Oct : - : (:)
reboot system boot 2.6.-.el6.x Mon Sep : - : (+:)
reboot system boot 2.6.-.el6.x Sun Sep : - : (:)
reboot system boot 2.6.-.el6.x Sun Sep : - : (:)
reboot system boot 2.6.-.el6.x Sun Sep : - : (:)
reboot system boot 2.6.-.el6.x Sun Sep : - : (:) wtmp begins Sun Sep ::
5、top命令
up后表示系统到目前运行了多久时间。反过来推算系统重启时间
[root@rusky opt]# top
top - 16:10:12 up 4 days, 11:05, 4 users, load average: 0.00, 0.00, 0.00
Tasks: 421 total, 1 running, 420 sleeping, 0 stopped, 0 zombie
……
6、w命令
up后表示系统到目前运行了多久时间。反过来推算系统重启时间
[root@rusky opt]# w
16:47:16 up 4 days, 11:42, 3 users, load average: 0.00, 0.00, 0.00
7、uptime命令及查看/proc/uptime
[root@rusky opt]# uptime
:: up days, :, users, load average: 0.00, 0.00, 0.00 [root@rusky opt]# date -d "`cut -f1 -d. /proc/uptime` seconds ago" --查看最近一次系统重启的时间
Sat Dec :: CST [root@rusky opt]# date -d "$(awk -F. '{print $1}' /proc/uptime) second ago" +"%Y-%m-%d %H:%M:%S"
-- ::