Linux下如何查看系统启动时间和运行时间
来源:互联网 发布:百度大数据怎么使用 编辑:程序博客网 时间:2024/05/22 17:40
Linux下如何查看系统启动时间和运行时间
1.uptime命令
输出:16:11:40 up 59 days, 4:21, 2 users, load average: 0.00, 0.01, 0.00
输出:16:11:40 up 59 days, 4:21, 2 users, load average: 0.00, 0.01, 0.00
2.查看/proc/uptime文件计算系统启动时间
cat /proc/uptime
输出: 5113396.94 575949.85
第一数字即是系统已运行的时间5113396.94 秒,运用系统工具date即可算出系统启动时间
date -d "$(awk -F. '{print $1}' /proc/uptime) second ago" +"%Y-%m-%d %H:%M:%S"
输出: 2008-11-09 11:50:31
3.查看/proc/uptime文件计算系统运行时间
cat /proc/uptime| awk -F. '{run_days=$1 / 86400;run_hour=($1 % 86400)/3600;run_minute=($1 % 3600)/60;run_second=$1 % 60;printf("系统已运行:%d天%d时%d分%d秒",run_days,run_hour,run_minute,run_second)}'
输出:系统已运行:59天4时13分9秒
- Linux下如何查看系统启动时间和运行时间
- Linux下如何查看系统启动时间和运行时间
- Linux下如何查看系统启动时间和运行时间
- Linux下如何查看系统启动时间和运行时间
- Linux下如何查看系统启动时间和运行时间
- Linux下如何查看系统启动时间和运行时间
- Linux下如何查看系统启动时间和运行时间
- Linux下如何查看系统启动时间和运行时间
- Linux下如何查看系统启动时间和运行时间
- Linux下如何查看系统启动时间和运行时间
- Linux下如何查看系统启动时间和运行时间
- Linux下如何查看系统启动时间和运行时间
- Linux下如何查看系统启动时间和运行时间
- Linux下如何查看系统启动时间和运行时间
- Linux下如何查看系统启动时间和运行时间
- Linux下如何查看系统启动时间和运行时间
- Linux 下查看系统启动和运行时间
- 转载_Linux下如何查看系统启动时间和运行时间
- SPRING-MVC 自动注入
- Myeclipse 调试时老是进入java内部方法 URLclassloader
- ABAP 常用FUNCTION集锦
- 于丹的婚姻观 不读是遗憾 不深度不深悟更遗憾
- 35 岁前程序员要规划好的四件事
- Linux下如何查看系统启动时间和运行时间
- 读《JavaServer Faces 核心编程(第3版)》一书的记录—— 第 4 章 标准 JSF 标签——案例 messages
- BIT 1001 Average Numbers
- python 网络编程1
- Error Provider Cannot display &
- BIT 1003 Exchange for Cola
- git学习笔记(2)-创建仓库、更新代码
- BIT 1004 Who is the Smartest Man
- BIT 1005 穿越沙漠