摘要: top 命令 %us:表示用户空间程序的cpu使用率(没有通过nice调度) %sy:表示系统空间的cpu使用率,主要是内核程序。 %ni:表示用户空间且通过nice调度过的程序的cpu使用率。 %id:空闲cpu %wa:cpu运行时在等待io的时间 %hi:cpu处理硬中断的数量 %si:cpu 阅读全文
posted @ 2022-05-29 14:09 lucky_tomato 阅读(1361) 评论(0) 推荐(0) 编辑
摘要: 1、centos安装dig命令 yum -y install bind-utils 2、简单使用 dig www.boyblue.xyz ; <<>> DiG 9.11.4-P2-RedHat-9.11.4-26.P2.el7_9.9 <<>> www.boyblue.xyz ;; global o 阅读全文
posted @ 2022-05-29 12:06 lucky_tomato 阅读(173) 评论(0) 推荐(0) 编辑
摘要: Branch 'master' set up to track remote branch 'master' from 'origin' git上传仓库时报错 解决方法共两步 1、移除 git remote rm origin 2、再次连接 git remote add origin '仓库地址' 阅读全文
posted @ 2022-05-29 12:01 lucky_tomato 阅读(1463) 评论(0) 推荐(0) 编辑
摘要: from collections import Counter n = ['a','b','a','c','d','a'] # 统计list中每个元素出现的个数 eleCounts = Counter(n) # most_common()返回出现次数排名前n个的元素,不输入时默认按照出现次数对所有数 阅读全文
posted @ 2022-05-29 11:55 lucky_tomato 阅读(354) 评论(0) 推荐(0) 编辑
摘要: def max_list(lt): temp = 0 for i in lt: if lt.count(i) > temp: max_ele = i temp = lt.count(i) return "重复次数最多元素为%s,重复次数为%d次" % (max_ele, temp) n = ['a' 阅读全文
posted @ 2022-05-29 11:50 lucky_tomato 阅读(1123) 评论(0) 推荐(0) 编辑
摘要: 获取内存信息 使用psutil获取物理内存和交换内存信息,分别使用: >>> psutil.virtual_memory() svmem(total=8589934592, available=2866520064, percent=66.6, used=7201386496, free=21617 阅读全文
posted @ 2022-05-29 11:32 lucky_tomato 阅读(640) 评论(0) 推荐(0) 编辑
摘要: # 用法 awk 'END {print}' 文件名 例子: cat test.txt 123 456 awk 'END {print}' test.txt 456 阅读全文
posted @ 2022-05-29 11:09 lucky_tomato 阅读(2740) 评论(0) 推荐(0) 编辑
摘要: 第一种 top -bn 2 -i -c | grep 'Cpu(s)' | awk '{sum=$2 + $4};END {print sum}' 第二种 sar -u 1 1 | grep Average | awk '{sum=$3 + $5};END {print sum}' 阅读全文
posted @ 2022-05-29 09:38 lucky_tomato 阅读(232) 评论(0) 推荐(0) 编辑
摘要: 格式化输入容器ID作为docker rm的入参,实现批量删除docker容器 docker ps -a --format="{{ .ID }}" | xargs docker rm 获取docker版本号 docker version --format='{{ .Client.Version }}' 阅读全文
posted @ 2022-05-29 09:30 lucky_tomato 阅读(93) 评论(0) 推荐(0) 编辑