CentOS的常用命令使用是基本功,需要查看系统的启动时间和运行时间,分享给大家一起学习,共同进步。
1.uptime命令[spark@MasterLog_Data]$uptime
09:18:01up20:17,1user,loadaverage:0.13,0.12,0.14
2.查看/proc/uptime文件计算系统启动时间[spark@MasterLog_Data]$cat/proc/uptime
73064.44276161.85
输出: 73064.44 276161.85 第一数字即是系统已运行的时间73064.44 秒,运用系统工具date即可算出系统启动时间
代码:[spark@MasterLog_Data]$date-d"$(awk-F.'{print$1}'/proc/uptime)secondago"+"%Y-%m-%d%H:%M:%S"
-12-0213:00:59
3.查看/proc/uptime文件计算系统运行时间
代码:[spark@MasterLog_Data]$cat/proc/uptime|awk-F.'{run_days=$1/86400;run_hour=($1%86400)/3600;run_minute=($1%3600)/60;run_second=$1%60;printf("系统已运行")
本文来自投稿,不代表访得立场,如若转载,请注明出处://view/1377.html