Determine who is monopolizing the CPU
来源:互联网 发布:浏览器地址栏执行js 编辑:程序博客网 时间:2024/05/16 06:47
$ ps -eo pcpu,size:8,user,start_time,pid,args | sort -nk 1 -r |egrep -v "COMMAND|egrep -v|start_time"| head -10
The ps
command displays every process (-e
) with user-defined format (e.g.,-o pcpu
).
pcpu = CPU usage percentage
size = memory size in kB (with 8 character long field — otherwise the formatting is messed up!)
user = user name
start_time = start time
pid = process ID,
args = command being run
The sort
command sorts the lines numerically (-n
) in the reverse order (-r
) based on the first field (-k 1
).
Then egrep -v
filters the lines that do not match the header (containing COMMAND), egrep and ps commands themselves.
The head -10
command filters out top 10 lines from the list generated by previoussort
. (Note: here -10 is actually redundant since head command prints out top 10 lines by default, but it is there as a reminder that we can print more lines using a number greater than 10 it if there is a need!)
Credit: Nixcraft.
- Determine who is monopolizing the CPU
- who is the real hero!
- Who is the Smartest Man
- HDU5123 who is the best?
- Who is the lion(谁是狮子)!
- zoj3519 Who is the Smartest Man//贪心
- zoj 3519 Who is the Smartest Man
- zoj 3519 Who is the Smartest Man
- ZOJ3519 BIT1004 Who is the Smartest Man
- bit Who is the Smartest Man
- Who is the Smartest Man 解题报告
- BIT 1004 Who is the Smartest Man
- xtuoj-who is the Kth number
- hdu 5123 who is the best?
- hdu 5123 who is the best?
- 杭电5123 who is the best?
- 判断游戏胜者-Who Is the Winner
- Gym-100712A-Who Is The Winner
- 解决adb.exe 已停止工作问题
- ERROR解决
- Download Qt, the cross-platform application framework
- C++面试题__1__成员函数的调用
- C/C++中的递归与非递归排序
- Determine who is monopolizing the CPU
- mysql_num_fields与mysql_field_count的区别
- java下载word功能
- Android API 新特性(1.5到4.0)
- IOS之正则表达式(二)
- java中的元注解
- quick_sort
- C程序调试利器。__DATE__ ,__TIME__,__FILE__,__LINE__,__FUNCTION__
- 添加外键的时候 出现了1452错误