美文网首页软件测试职业探索测试员的那点事
几种常用的「查看Linux开机时间」的命令

几种常用的「查看Linux开机时间」的命令

作者: IDO老徐 | 来源:发表于2019-06-21 10:01 被阅读24次

很多时候,工作需要,需要知道Linux系统运行了多久时间,上次开机启动时间;

1: who 命令查看

  who -b 查看最后一次系统启动的时间。

  who -r 查看当前系统运行时间

who -b
[istester@iZ94b31ttqsZ istester.com]$ who -b
system boot 2019-03-31 11:32

或者,who -r

[istester@iZ94b31ttqsZ istester.com]$ who -r
run-level 3 2019-03-31 11:32

2: last reboot

如下所示last reboot可以看到Linux系统历史启动的时间。 重启一下操作系统后,然后

[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)

如果只需要查看最后一次Linux系统启动的时间

[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)

3:TOP命令查看

如下截图所示,up后表示系统到目前运行了多久时间。反过来推算系统重启时间

image.png

4: w命令查看

如下截图所示,up后表示系统到目前运行了多久时间。反过来推算系统重启时间

[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 w

5:uptime 命令查看

[istester@iZ94b31ttqsZ istester.com]$ uptime
10:01:37 up 81 days, 22:29, 2 users, load average: 0.00, 0.00, 0.00

相关文章

  • 几种常用的「查看Linux开机时间」的命令

    很多时候,工作需要,需要知道Linux系统运行了多久时间,上次开机启动时间; 1: who 命令查看 who -b...

  • 查看Linux开机时间常用的命令

    1.命令:who who -r 查看当前系统运行时间who -b查看最后一次系统启动的时间 2.命令:last r...

  • Linux 常用的几种日志查看方法

    Linux查看日志的命令有多种: tail、cat、tac、head、echo等,本文只介绍几种常用的方法。 1、...

  • free 命令

    Linux内存查看命令 在Linux下面,我们常用top命令来查看系统进程,top也能显示系统内存。我们常用的Li...

  • 20220816笔记

    Linux常用操作 Linux查看文件内容命令 运行以及停止jar包命令(Linux) 写入文件命令 maven常...

  • Linux常用命令

    Linux常用命令操作 1.日常操作命令 pwd 查看当前所在工作目录 date 查看当前系统时间 who 查看当...

  • Linux常用命令

    Linux常用命令 查看系统信息常用命令 常用命令-关机或重启命令 命令前结构

  • Linux学习

    Linux文件目录 ls常用选项 文本查看常用命令 tar命令 账号管理命令 useradd [username]...

  • 常用的Linux下查看服务器配置的命令

    常用的Linux下查看服务器配置的命令

  • Linux服务器部署 资料整理

    1、Linux系统常用的命令,Linux查看系统配置常用命令 2、Linux如何配置ftp服务器、给ftp服务器添...

网友评论

    本文标题:几种常用的「查看Linux开机时间」的命令

    本文链接:https://www.haomeiwen.com/subject/oiveqctx.html