365提款经验-365bet官方亚洲版-365视频直播

ubuntu查看系统开机/运行时间与重启次数

ubuntu查看系统开机/运行时间与重启次数

1.uptime命令# uptime 22:39:49 up 20 min, 1 user, load average: 1.50, 0.85, 0.50提示:

本机当前22点39分49秒,运行了20分钟。

2.通过/proc/uptime计算开机时间# date -d "$(awk -F. '{print $1}' /proc/uptime) second ago" +"%Y-%m-%d %H:%M:%S"2022-11-01 22:19:14提示:

本机2022-11-01 22:19:14开机。

3.通过/proc/uptime计算系统运行时间cat /proc/uptime| awk -F. '{days=$1 / 86400;hour=($1 % 86400)/3600;min=($1 % 3600)/60;sec=$1 % 60;printf("系统已运行:%d天%d时%d分%d秒\n",days,hour,min,sec)}'系统已运行:0天0时28分16秒4.查看最后一次系统启动的时间# who -b系统引导 2022-11-02 06:195.查看当前系统运行时间# who -r运行级别 5 2022-11-02 06:196.系统历史启动的时间# last rebootreboot system boot 5.15.0-41-generi Wed Nov 2 06:19 still runningreboot system boot 5.15.0-41-generi Wed Nov 2 06:17 - 06:17 (00:00)7.w命令查看# w --helpw --help 用法: w [选项] 选项: -h, --no-header do not print header -u, --no-current ignore current process username -s, --short short format -f, --from show remote hostname field -o, --old-style old style output -i, --ip-addr display IP address instead of hostname (if possible)# w 22:52:03 up 32 min, 1 user, load average: 0.18, 0.42, 0.47查看是否有远程主机连入本机

# w -fu