---
title: "Linux 性能检测命令"
author: "boendev"
date: "2012-08-06T14:05:44Z"
tags: []
categories: ["操作系统"]
slug: "linux"
draft: false
lastmod: "2012-08-06T14:06:44Z"
id: 1622232
url: "https://boendev.iteye.com/blog/1622232"
---

\# top 

 

\# free

 

\# linux 下 取进程占用 cpu 最高的前10个进程  
ps aux|head -1;ps aux|grep -v PID|sort -rn -k +3|head

\# linux 下 取进程占用内存(MEM)最高的前10个进程  
ps aux|head -1;ps aux|grep -v PID|sort -rn -k +4|head

 

 

 

 

 

功能：查找出占用CPU最多的前5个进程

ps aux | sort -k3nr | head -n 5

注：结果的第三列为CPU占用率

方法2：

TOP:

运行top命令后，然后按大写字母P，即可实现按CPU的使用率排序。

 

查找出占用内存最多的前5个进程

ps aux | sort -k4nr | head -n 5

注：结果的第4列为内存占用率

方法2：

TOP:

运行top命令后，然后按大写字母M，即可实现按内存的使用率排序。