Sometimes you need to check how long the Linux system has been running. At this time, you need to know the start time of the last boot. Sometimes, due to power failure or power supply failure, you need to check the Linux boot time/restart time; the following summarizes some methods for viewing the Linux boot shutdown time (very comprehensive)
1: who command to view
Who-B view the last system startup time.
Who-r: view the current system running time
[Root @ DB-Server ~] # Who-B
System boot May 11
2: last reboot
As shown in the following figure, you can see the Linux system historical start time in last reboot. After restarting the operating system
[Root @ DB-Server ~] # Last reboot
Reboot system boot 2.6.9-42. ELsmp Thu May 29)
Reboot system boot 2.6.9-42. ELsmp Sun May 11 (18 + 05: 55)
Wtmp begins Mon May 5 16:18:57 2014
If you only need to view the last Linux Startup time
[Root @ DB-Server ~] # Last reboot | head-1
Reboot system boot 2.6.9-42. ELsmp Thu May 29)
3: view TOP commands
As shown in the following figure, "up" indicates how long the system has been running. In turn, the system restart time is estimated.
4: view the w command
4: view the w command
As shown in the following figure, "up" indicates how long the system has been running. In turn, the system restart time is estimated.
5: view the uptime command
6: View/proc/uptime
[Root @ DB-Server ~] # Cat/proc/uptime
1415.59 1401.42
[Root @ DB-Server ~] # Date-d "'cut-f1-d./proc/uptime 'Seconds ago"
Thu May 29 15:24:57 CST 2014
[Root @ DB-Server ~] # Date-d "$ (awk-F. '{print $1}'/proc/uptime) second ago "+" % Y-% m-% d % H: % M: % S"
15:24:57
References:
Http://www.thegeekstuff.com/2011/10/linux-reboot-date-and-time/
Http://www.averainy.info/linux-system-operation-time-and-the-view-of-the-latest-powered-up-time/