企业级-Shell案例5——找出占用CPU 内存过高的进程

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

背景:服务器CPU占用高,找出最高的分析,看是否进程正确,是否是垃圾进程

分析占用CPU最高的应用

ps -eo user,pid,pcpu,pmem,args --sort=-pcpu  |head -n 10

分析占用内存最高的应用

ps -eo user,pid,pcpu,pmem,args --sort=-pmem  |head -n 10

整合脚本

#!/bin/bash
echo "-------------------CUP占用前10排序--------------------------------"
ps -eo user,pid,pcpu,pmem,args --sort=-pcpu  |head -n 10
echo "-------------------内存占用前10排序--------------------------------"
ps -eo user,pid,pcpu,pmem,args --sort=-pmem  |head -n 10

发布了165 篇原创文章 · 获赞 39 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/heian_99/article/details/104030019
今日推荐