文章目录

找出占用CPU/内存过高的进程

1. CPU 过高的进程
2. 内存 过高的进程

1. 脚本

#/bin/bash
echo "----------------------- CPU TOP 10------------------------"
ps -eo user,pid,pcpu,pmem,args --sort=-pcpu |head -n 10
echo "----------------------- MEM TOP 10------------------------"
ps -eo user,pid,pcpu,pmem,args --sort=-pmem |head -n 10

2. 运行脚本

#赋予可执行权限
chmod +x 5.sh
#运行脚本
./5.sh

3. 效果图

Linux Shell脚本专栏_找出占用CPU/内存过高的进程_05_bash

Linux Shell脚本专栏_找出占用CPU/内存过高的进程_05_bash_02