很多时候,工作需要,需要知道Linux系统运行了多久时间,上次开机启动时间;51Testing软件测试网R[c~-b
1: who 命令查看51Testing软件测试网 hX4lA.`a+n
who -b 查看最后一次系统启动的时间。
who -r 查看当前系统运行时间
who -b
[istester@iZ94b31ttqsZ istester.com]$ who -b
system boot 2019-03-31 11:3251Testing软件测试网0m:|tT
RpL5O-fl
或者,who -r51Testing软件测试网 ec,NO+xT,l
[istester@iZ94b31ttqsZ istester.com]$ who -r
run-level 3 2019-03-31 11:3251Testing软件测试网v6oNl3I4?a
2: last reboot
7H"B6}0q(l;s8GO'n0如下所示last reboot可以看到Linux系统历史启动的时间。 重启一下操作系统后,然后
l$[)IAh/v/S],~LP`0[istester@iZ94b31ttqsZ istester.com]$ last reboot
reboot system boot 2.6.32-431.23.3. Sun Mar 31 11:32 - 09:58 (81+22:25)
reboot system boot 2.6.32-431.23.3. Sun Mar 31 11:05 - 11:31 (00:26)
reboot system boot 2.6.32-431.23.3. Wed Nov 29 00:08 - 10:47 (487+10:39)
reboot system boot 2.6.32-431.23.3. Sun Sep 27 15:56 - 00:07 (793+08:10)
reboot system boot 2.6.32-431.23.3. Wed Jun 24 18:22 - 00:28 (94+06:06)
reboot system boot 2.6.32-431.23.3. Wed Jun 24 18:13 - 18:21 (00:08)
reboot system boot 2.6.32-431.23.3. Wed Jun 24 17:50 - 18:13 (00:22)
reboot system boot 2.6.32-431.23.3. Tue Jun 23 18:17 - 17:50 (23:32)
reboot system boot 2.6.32-431.23.3. Wed Mar 4 10:47 - 18:15 (111+07:28)
reboot system boot 2.6.32-431.23.3. Wed Mar 4 10:41 - 10:46 (00:05)
reboot system boot 2.6.32-431.23.3. Wed Dec 31 10:53 - 10:46 (62+23:53)51Testing软件测试网&B|3fl(A3`O$v8iB
如果只需要查看最后一次Linux系统启动的时间51Testing软件测试网I_+r[9T0\
[istester@iZ94b31ttqsZ istester.com]$ last reboot | head -1
reboot system boot 2.6.32-431.23.3. Sun Mar 31 11:32 - 09:58 (81+22:26)51Testing软件测试网jR(Rj'Teb.C0W
3:TOP命令查看
/h]en
G/iz0如下截图所示,up后表示系统到目前运行了多久时间。反过来推算系统重启时间
2eu,J&K%Q04: w命令查看51Testing软件测试网 L4ZL#Q7R0Iz:Q/PXY
如下截图所示,up后表示系统到目前运行了多久时间。反过来推算系统重启时间51Testing软件测试网Z"I"S
B],N
[istester@iZ94b31ttqsZ istester.com]$ w
10:01:00 up 81 days, 22:28, 2 users, load average: 0.00, 0.00, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 183.14.133.208 09:50 8:37 0.00s 0.00s -zsh
root pts/1 183.14.133.208 09:55 0.00s 0.02s 0.00s w51Testing软件测试网:I&[~j4V%C;R|c0f
5:uptime 命令查看
$ki2sf+Y*S*a0[istester@iZ94b31ttqsZ istester.com]$ uptime
10:01:37 up 81 days, 22:29, 2 users, load average: 0.00, 0.00, 0.0051Testing软件测试网5?qBi9W+l$NbrJ