查看本机CPU、内存使用率前10的进程

在日常运维工作中,经常会查看占用当前系统CPU或内存使用率前几位的进程情况。下面列出这些查看的命令:

查看占用CPU最高的5个进程
ps aux | sort -k3rn | head -5
或者
top (然后按下P,注意大写,CPU使用率降序)

查看占用内存最高的5个进程
ps aux | sort -k4rn | head -5
或者
top (然后按下M,注意大写,内存使用率降序)

查看所有信息使用命令
ps aux

sort -rn 降序
sort -k3rn 按照第三列降序

sort|uniq 排序去重
sort|uniq -c 打印重复的次数
sort|uniq -d 打印交集的部分
sort|uniq -u 打印去掉交集的部分

例子:

[[email protected] ~]# cat a
sdfasasdf
2
3
4
asdfasf
asdfsdfasdfasdf

[[email protected] ~]# cat b
adfasf1231
2
3
sdf435
4

[[email protected] ~]# cat a b|sort|uniq
2
3
4
adfasf1231
asdfasf
asdfsdfasdfasdf
sdf435
sdfasasdf
[[email protected] ~]# cat a b|sort|uniq -c
2 2
2 3
2 4
1 adfasf1231
1 asdfasf
1 asdfsdfasdfasdf
1 sdf435
1 sdfasasdf
[[email protected] ~]# cat a b|sort|uniq -d
2
3
4
[[email protected] ~]# cat a b|sort|uniq -u
adfasf1231
asdfasf
asdfsdfasdfasdf
sdf435
sdfasasdf

时间: 2024-07-29 15:19:20

查看本机CPU、内存使用率前10的进程的相关文章

linux 列出内存/cpu使用率前10的进程

内存使用率前10行 # ps aux | head -1;ps aux | grep -v PID | sort -rn -k +4 | head CPU使用率前10行 # ps aux | head -1;ps aux | grep -v PID | sort -rn -k +3 | head ps aux | head -1 是 先显示出个字段的名称 grep -v PID 去除字段名称 sort -rn -k +4按照第4列排序 head 默认取前10行 原文地址:https://www.

【转】Linux 下取进程占用 cpu/内存 最高的前10个进程

# 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 转自:http://blog.csdn.net/namesliu/article/details/6037972

linux 下取进程占用 cpu/内存 最高的前10个进程

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

Linux终端查看最消耗CPU内存的进程

1.CPU占用最多的前10个进程 ps auxw|head -1;ps auxw|sort -rn -k3|head -10 2.内存消耗最多的前10个进程 ps auxw|head -1;ps auxw|sort -rn -k4|head -10 3.虚拟内存使用最多的前10个进程 ps auxw|head -1;ps auxw|sort -rn -k5|head -10 4.也可以试试 ps auxw --sort=rss ps auxw --sort=%cpu 5.看看几个参数含义 %ME

老男孩教育每日一题-2017年3月21日:查找占用内存的前3名进程

查找占用内存的前3名进程(命令大风暴,看谁的命令最精简) 参考答案: 方法一 top 按内存列排序,使用>可以移动到以内存排序 x高亮 z 加颜色 方法二 top -a  以内存排序 方法三 htop 可以使用鼠标点击按内存列排序 注:需要yum安装(epel源) # 查看进程按内存从大到小排列 方法四 [[email protected] ~]# ps -eo "%C  : %p : %z : %a" --sort -vsz %CPU  :    PID :   VSZ : C

Ubuntu 16.04安装indicator-sysmonitor实现导航条显示上下行网速/CPU/内存使用率

安装: sudo add-apt-repository ppa:fossfreedom/indicator-sysmonitor sudo apt-get update sudo apt-get install indicator-sysmonitor 启动: indicator-sysmonitor & 提示:按Ctrl+C退出. 开机启动: 配置: 在上方输入:CPU: {cpu} 内存: {mem} 网络:{net},然后按Test即可看见效果,最后保存即可.

查看CentOS的CPU内存信息及操作系统的版本信息

经常要查看Linux服务器的CPU,内存信息以及操作系统版本等信息,总结一下常用的命令,以便以后查阅.1.查看CPU型号(8个逻辑CPU)[[[email protected] ~]# cat /proc/cpuinfo |grep "name" |cut -f2 -d: |uniq -c8 Intel(R) Xeon(R) CPU           E5506  @ 2.13GHz2.查看物理CPU个数(两个4核CPU)[[email protected] ~]# cat /pro

C#做的CPU内存使用率

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Diagnostics; using System.Threading; using System.Run

shell监控之列出1小时内cpu占用最多的10个进程

脚本内容如下: ------------------------------------------------------------------------------------------------------- #!/bin/sh #定义变量 secs=3600unit_time=60 stepts=$(( $secs / $unit_time )) echo CPU usage...; for((i=0;i<stepts;i++))do    ps -eo comm,pcpu |