Solved

top memory and cpu consumers on Linux

Posted on 2010-09-17
3
591 Views
Last Modified: 2012-05-10
I would like to know if there is a command i can output to a file which will report the top memory and cpu consuming processes on a server (Linux).  top command is useful but i am not familiar with it to the point to where I can clearly report the top 5 or 10 consuming processes and with a clear indication of the "impacting" processes in question.

Thank you
Rich
0
Comment
Question by:newtontech4
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
joseleonardo earned 250 total points
ID: 33703966
Hi, a command would be this

root@localhost#top -bn 1 | head -13 | sed -re ':l;s/^ //;tl;/^[^0-9]/d' >> top5.txt

another form will be

root@localhost#top -bn 1 | head -13 >> top5.txt

0
 
LVL 6

Assisted Solution

by:Jelcin
Jelcin earned 250 total points
ID: 33703982
top -b -d 1 -n 5 > top

this command tells top to run in batch mode "-b" have an delay of 1 second "-d 1" between screen refreshes with "-n 5"  5 iterations. The "> top" pipes the result in the file top.
0
 
LVL 6

Expert Comment

by:Jelcin
ID: 33704061
By default, the process status output is generated with the most CPU-intensive processes at the top of the listing. "info top" gives you more information about the top command.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
open source backup solution 1 36
android secure ftp 3 50
trouble on installing syslog-ng on CentOS 7 7 54
Apache LDAP Authentication 20 31
I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question