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)}' 

      

uptime: uptime  gives  a  one  line display of the following information.  The current time, how long the system has been
             running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes.

字符串转数组: swapfield=($swapfiled)

原文地址:https://www.cnblogs.com/openix/p/3478351.html