很多时候,工作需要,需要知道Linux系统运行了多久时间,上次开机启动时间;
(a$[_c QHw9wXsu9~01: who 命令查看
+e)xq/q1pN0who -b 查看最后一次系统启动的时间。
who -r 查看当前系统运行时间
who -b
[istester@iZ94b31ttqsZ istester.com]$ who -b
system boot 2019-03-31 11:3251Testing软件测试网:fh{Nk
u8y5Fm
或者,who -r51Testing软件测试网
x4LmJ)P[
[istester@iZ94b31ttqsZ istester.com]$ who -r
run-level 3 2019-03-31 11:32
Tp7w$e/K0
2: last reboot51Testing软件测试网}$OmybT;h
如下所示last reboot可以看到Linux系统历史启动的时间。 重启一下操作系统后,然后
Q&U"i,i b1tH/p"w@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软件测试网-f5H'kPXf
如果只需要查看最后一次Linux系统启动的时间51Testing软件测试网4\0e5izF)q{E
[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)
x:v-S3{y!`6T0
3:TOP命令查看51Testing软件测试网8V$xU6tW5hO3PN/B
如下截图所示,up后表示系统到目前运行了多久时间。反过来推算系统重启时间51Testing软件测试网"kS'}#MT_KfC
4: w命令查看
u2M/]$eKf-e0如下截图所示,up后表示系统到目前运行了多久时间。反过来推算系统重启时间
%\*WHr0YP0[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软件测试网,Kx@MF7k
5:uptime 命令查看51Testing软件测试网lOv/}El$a_)R
[istester@iZ94b31ttqsZ istester.com]$ uptime
10:01:37 up 81 days, 22:29, 2 users, load average: 0.00, 0.00, 0.0051Testing软件测试网"B/i/qMe6f!eCLb({