1.uptime命令
输出:16:11:40 up 59 days,4:21,2 users,load average: 0.00,0.01,0.00
2.查看/proc/uptime文件计算系统启动时间
cat /proc/uptime
输出: 5113396.94 575949.85
第一数字即是系统已运行的时间5113396.94 秒,运用系统工具date即可算出系统启动时间
-
@H_450_20@
代码:
3.查看/proc/uptime文件计算系统运行时间
1: who 命令查看
who -b 查看最后一次系统启动的时间。
who -r 查看当前系统运行时间
2: last reboot
如下所示last reboot可以看到Linux系统历史启动的时间。 重启一下操作系统后,然后
[[email protected] ~]# last reboot
1
2
3
4
|
[[email protected] ~]
# last reboot
reboot system boot 3.10.0-327.el7.x Fri Oct 27 14:32 - 14:59 (00:26)
wtmp begins Fri Oct 27 14:32:39 2017
|
#如果只需要查看最后一次Linux系统启动的时间
[[email protected] ~]
# last reboot | head -1
reboot
system boot 2.6.9-42.ELsmp Thu May 29 15:25 (00:08)
|
3:TOP命令查看
如下截图所示,up后表示系统到目前运行了多久时间。反过来推算系统重启时间
[[email protected] ~]
# who -b
Tasks: 99 @R_412_10586@l, 1 running, 98 sleeping, 0 stopped, 0 zombie
%cpu(s): 0.0 us, 0.2 sy, 0.0 ni,99.8
id
, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
PID USER PR nI VIRT RES SHR S %cpu %MEM TIME+ COMMAND
10 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob
/1
11 root 20 0 0 0 0 S 0.0 0.0 0:00.33 rcu_sched
|