统计linux系统进程内存使用百分比

打印一次所有进程情况

top -b -n 1

忽略前面8行

tail -n +8

统计

top -b -n 1  \
|awk '{print $10}'\
|tail -n +8 \
|xargs  -i echo "{} +" \
|xargs -r \
|xargs -i python -c "print( {} 0)"

统计2

ps axu --sort -rss \
|awk '{print $6}'|tail -n +2 \
|xargs  -i echo "{} +"|xargs -r \
|xargs -i python -c "print( {} 0)"

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.