1.uptime命令 例子显示已启动13天 当前用户一个
[root@localhost-live version-build-related]# uptime 19:20:41 up 13 days, 8:23, 1 user, load average: 1.38, 1.55, 1.56
2.查看/proc/uptime文件计算系统启动时间
[root@localhost-live version-build-related]# cat /proc/uptime
1153389.58 3457597.11 运用系统工具date算出系统启动时间
[root@localhost-live version-build-related]# date -d "$(awk -F. '{print $1}' /proc/uptime) second ago" +"%Y-%m-%d %H:%M:%S"
2018-03-13 10:57:04
2018-03-13 10:57:04
3.查看/proc/uptime文件计算系统运行时间
[root@localhost-live version-build-related]# 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)}' 系统已运行:13天8时26分27秒
4、查看系统安装时间
tune2fs -l /dev/sda1 | grep create
[root@localhost-live version-build-related]# tune2fs -l /dev/sda1 | grep create Filesystem created: Mon Mar 12 09:41:12 2018