In Linux look for the highest memory and CPU usage by Top running processes

Find the first 15 processes by memory usage, in batch mode to "top"

Use the top command to view information about the current status, more detailed information about the usage of the system: uptime, load average and total number of processes.

Similar to the previous tips on to find out the process by the highest RAM and CPU usage  , you can also use the top command to view the same information. There may be a front compared to a additional advantage of this approach: top "head", provides information on the current status and additional information about the system: uptime, load average and total number of processes, to name a few examples.

Find a process by memory used by top

Find a process by memory used by top

To sort in descending arrangement of the first 15 processes sorted by memory usage, execute:

# top -b -o +%MEM | head -n 22

Comparison with the previous technique, where you have to use +%MEM (note plus sign), the output of sort in descending order:

Memory usage listed by process before 15

Memory usage listed by process before 15

From the above commands, options:

  1. -b : Top run in batch mode
  2. -o : Designated areas for sorting process
  3. headUtility displays the first few lines of the file
  4. In -noption to specify the number of rows to be displayed.

It should be noted that the first effect, the default file the first ten lines of the display, that is, when you do not specify the number of rows to be displayed. Thus, in the above example, we show that the first 22 rows of the top of the command output in batch mode.

Redirect or save the 'top' output to a file in Linux

Also, in batch mode before  , the output is redirected to a file for later examination of:

# top -b -o +%MEM | head -n 22 > topreport.txt

正如我们所看到的, 顶部工具为我们提供而Linux系统上上市进程,因此,这种方法有一个额外的好处相比,使用更多的动态信息PS工具 ,我们覆盖尖之一。

但最重要的,你必须始终之上运行在批处理模式下其输出重定向到文件或其他程序。 此外,如果您有任何关于使用顶部的任何提示,也可以与我们通过下面的反馈表分享。

 

 

在Linux中通过Top运行进程查找最高内存和CPU使用率

在这篇文章中,我们将分享一个技巧,找出,哪些Linux运行的进程消耗大量的内存(RAM)和CPU利用率后代形式。

我记得一次阅读,高效的系统管理员是懒惰的人。原因不是他们不在做他们的工作或浪费他们的时间 - 这主要是因为他们已经自动化了大量的日常任务。因此,他们不必保管他们的服务器,可以利用他们的时间学习新技术,并始终保持在他们的游戏的top。 自动化你的任务的一部分,是学习如何获得一个脚本做什么你必须做自己否则。继续向您自己的知识库添加命令同样重要。 因此,在本文中,我们将分享一个诀窍,找出哪些进程在Linux中消耗大量的内存和CPU利用率。
Find Linux process by RAM and CPU usage

按RAM和CPU使用率查找Linux进程

也就是说,让我们开始吧。

检查在Linux中按RAM或CPU使用率排序的Top Process

下面的命令将显示由RAM和CPU用在后代的形式(如果你想看到完整的列表中删除的 管道头部 )下令top进程的列表:
# ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head
示例输出
PID  	PPID 	CMD                      	%MEM 	%CPU
2591 2113 /usr/lib/firefox/firefox 7.3 43.5 2549 2520 /usr/lib/virtualbox/Virtual 3.4 8.2 2288 1 /home/gacanepa/.dropbox-dis 1.4 0.3 1889 1543 c:\TeamViewer\TeamViewer.ex 1.0 0.2 2113 1801 /usr/bin/cinnamon 0.9 3.5 2254 2252 python /usr/bin/linuxmint/m 0.3 0.0 2245 1801 nautilus -n 0.3 0.1 1645 1595 /usr/bin/X :0 -audit 0 -aut 0.3 2.5
By RAM and CPU usage to find popular procedure

按RAM和CPU使用查找热门过程

A brief description of the above options used in the above command. The -o  PS (or -format) option allows you to specify the output format. My favorite is to show the process'  of PID (PID), PPIDs (PID ), and process (CMD) related to the executable file (name and RAM and CPU utilization %mem and %cpu respectively). In addition, I use --sort two sort %mem or %cpu  . By default, output will rise in the form of the sort, but I personally like by adding a minus sign in front of the condition to reverse the sorting order. To add other fields output, or change the sort criteria, please refer to the manual pages of output format control section ps command.

Do not miss:  a 15-bit process before find a batch mode by memory usage with the 'top'

Do not miss:  Find ten Linux disk directory size

Overview

Linux server monitoring process is a system administrator of one of the many tasks, in this article, we discuss how to list processes on your system, and in accordance with PS descendants in the form of tools of RAM and CPU sort usage.
 
 

Guess you like

Origin www.cnblogs.com/xuanbjut/p/11647235.html