Linux
查看centos的运行时间和启动时间
老斑鸠 发表于2021-01-15 浏览2862 评论0
1、uptime命令:
运行此 命令将显示系统已经运行了多长时间,它依次显示下列信息:当前时间、系统已经运行了多长时间、目前有多少登陆用户、系统在过去的1分钟、5分钟和15分钟内的平均负载。
[root@cZEqhNpstj ~]# uptime 21:42:20 up 1 day, 1:50, 1 user, load average: 1.49, 1.23, 1.28
2、查看/proc/uptime文件计算系统启动时间:cat /proc/uptime
运行此命令会显示以空格分开的2组数值(以秒计),第一个为系统运行时间(即建立新系统运行到现在的时间),第二个为距离上次启动的时间。
[root@cZEqhNpstj ~]# cat /proc/uptime 93177.73 157961.20
3、将/proc/uptime中的时间直观显示:
显示系统运行时间:
[root@cZEqhNpstj ~]# cat /proc/uptime| awk -F ' ' '{run_days=$1 / 86400;run_hour=($1 % 86400)/3600;run_minute=($1 % 3600)/60;run_second=$1 % 60;printf("System Running Time: %d Days %d Hours %d Minutes %d Seconds\n",run_days,run_hour,run_minute,run_second)}' System Running Time: 1 Days 1 Hours 53 Minutes 39 Seconds
显示距离上次重启时间:
[root@cZEqhNpstj ~]# cat /proc/uptime| awk -F ' ' '{run_days=$2 / 86400;run_hour=($2 % 86400)/3600;run_minute=($2 % 3600)/60;run_second=$2 % 60;printf("Distance from the last start time: %d Days %d Hours %d Minutes %d Seconds\n",run_days,run_hour,run_minute,run_second)}' Distance from the last start time: 1 Days 19 Hours 54 Minutes 17 Seconds
Linux
centos下安装python3详细教程
老斑鸠 发表于2021-01-05 浏览2745 评论0
centos7 自带有 python,版本是python2.7接下来我们手动安装python3,并且配置后可以并存使用。1.首先,你要知道系统现在的python的位置在哪儿:[root@root ~]# whereis python
python: /usr/bin/python2.7 /usr/bin/python /usr/lib/python2.7 /usr/lib64/python2.7 /etc/pyth