1.查看/proc/uptime
root@master1565:~# cat /proc/uptime
673.83 1327.68
root@master1565:~# date -d "`cut -f1 -d. /proc/uptime` seconds ago"
Mon Apr 9 09:36:31 CST 2018
root@master1565:~# date -d "$(awk -F. '{print $1}' /proc/uptime) second ago" +"%Y-%m-%d %H:%M:%S"
2018-04-09 09:36:31推荐简单明了
date -d "$(awk -F. '{print $1}' /proc/uptime) second ago" +"%Y-%m-%d %H:%M:%S" 2. who 命令查看
who -b 查看最后一次系统启动的时间。who -r 查看当前系统运行时间
root@master1565:~# who -b
system boot 2018-03-30 23:20
root@master1565:~# who -r
run-level 5 2018-03-30 23:20
3. last reboot 可以看到Linux系统历史启动的时间
root@master1565:~# last reboot
reboot system boot 4.4.0-116-generi Mon Apr 9 09:36 still running
reboot system boot 4.4.0-116-generi Mon Apr 9 09:32 - 09:36 (00:03)
wtmp begins Sun Apr 1 21:24:06 2018查看最后一次Linux系统启动的时间
root@master1565:~# last reboot | head -1
reboot system boot 4.4.0-116-generi Mon Apr 9 09:36 still running4.TOP命令查看
root@master1565:~# top
5.w命令查看
root@master1565:~# w
6.uptime 命令查看
root@master1565:~# uptime
本文介绍了如何使用Linux命令查看系统的运行时间和启动时间,包括利用/proc/uptime文件、who命令、lastreboot命令及top和uptime命令等进行系统状态监测的方法。
1009

被折叠的 条评论
为什么被折叠?



