Linux 性能检查常用命令

####消耗CPU最多的进程
[root@Yong ~]# ps aux|head -1;ps aux|grep -v PID|sort -rn -k +3|head
##拼接进程号
[root@Yong ~]# ps -eo pid,%cpu --sort=-%cpu |grep -v PID|grep -v grep|head -10 |awk '{print $1}' |awk BEGIN{RS=EOF}'{gsub(/\n/,",");print "("$1")"}'
(16143,1,2,3,5,7,8,9,10,11)

####消耗内存最多的进程
[root@Yong ~]# ps aux|head -1;ps aux|grep -v PID|sort -rn -k +4|head
##拼接进程号
[root@Yong ~]# ps -eo pid,%cpu,%mem --sort=-%mem |grep -v PID|grep -v grep|head -10|awk '{print $1}' |awk BEGIN{RS=EOF}'{gsub(/\n/,",");print "("$1")"}'
(3498,1865,1857,1864,1861,22472,22473,354,3188,3189)


####查看系统消耗IO资源的进程,依赖iotop
[root@Yong ~]# iotop -o -b -n 10 -P|grep -v grep|head -10  
##拼接进程号
[Yong@Yong ~]$ ps -eo pid,%cpu --sort=-%cpu |grep -v PID|grep -v grep|head -10 |awk '{print $1}' |awk BEGIN{RS=EOF}'{gsub(/\n/,",");print "("$1")"}'
(16143,1,2,3,5,7,8,9,10,11)
##查看磁盘IO统计
[Yong@Yong ~]$ iostat -dx -k -t 2 1000000000 vda
Linux 3.10.0-693.21.1.el7.x86_64 (Yong)         07/12/2018      _x86_64_        (2 CPU)
07/12/2018 11:30:06 AM
Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
vda               0.00     0.12    0.06    0.34     1.16     7.29    42.80     0.02   38.98   25.42   41.26   0.78   0.03



#查看CPU信息(型号)
# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
# 查看物理CPU个数
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
# 查看每个物理CPU中core的个数(即核数)
cat /proc/cpuinfo| grep "cpu cores"| uniq
# 查看逻辑CPU的个数
cat /proc/cpuinfo| grep "processor"| wc -l

查看内存信息
# cat /proc/meminfo
查看主板型号:
# dmidecode |grep -A16 "System Information$"
查看机器型号
# dmidecode | grep "Product Name"
查看当前操作系统内核信息
# uname -a
查看当前操作系统发行版信息
# cat /etc/issue | grep Linux

猜你喜欢

转载自www.cnblogs.com/lYng/p/9441896.html
今日推荐