博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux查看系统开机时间
阅读量:2342 次
发布时间:2019-05-10

本文共 1066 字,大约阅读时间需要 3 分钟。

作者:
出处:

有时候需要查看Linux系统运行了多久时间,此时需要知道上次开机启动时间; 有时候由于断电或供电故障突然停机,需要查看Linux开机时间/重启时间;  下面总结一些查看Linux开机关机时间的方法(非常全面)

1: who 命令查看

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

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

[root@DB-Server ~]# who -b

         system boot May 11 09:27

2: last  reboot

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

[root@DB-Server ~]# last reboot

reboot system boot 2.6.9-42.ELsmp Thu May 29 15:25 (00:07)

reboot system boot 2.6.9-42.ELsmp Sun May 11 09:27 (18+05:55)

wtmp begins Mon May 5 16:18:57 2014

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

[root@DB-Server ~]# last reboot | head -1

reboot system boot 2.6.9-42.ELsmp Thu May 29 15:25 (00:08) 

3:TOP命令查看

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

4:w  命令查看

4: w命令查看

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

 

5:uptime 命令查看

6: 查看/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"  

2014-05-29 15:24:57

 

参考资料:

http://www.thegeekstuff.com/2011/10/linux-reboot-date-and-time/

转载地址:http://hifvb.baihongyu.com/

你可能感兴趣的文章
spring boot 打印sql
查看>>
我的死锁经历
查看>>
spring boot日志配置
查看>>
list排序
查看>>
maven依赖排除
查看>>
maven统一配置
查看>>
数据库连接池-配置 wallfilter
查看>>
BigDecimal快速使用
查看>>
spring cloud 配置纲要Properties
查看>>
java.lang.ClassNotFoundException: org.springframework.boot.context.embedded.FilterRegistrationBean
查看>>
恢复MySQL数据库删除的数据
查看>>
MySQL主从复制配置
查看>>
linux 安装jdk
查看>>
oracle 错误代码表
查看>>
ActiveMQ 入门使用p2p模型-主动消费
查看>>
ActiveMQ P2P模型 观察者消费
查看>>
ActiveMQ 安全认证
查看>>
ActiveMQ 持久化
查看>>
搭建zookeeper集群
查看>>
1005. 数独
查看>>