• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 610
  • Last Modified:

top memory and cpu consumers on Linux

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
newtontech4
Asked:
newtontech4
  • 2
2 Solutions
 
joseleonardoCommented:
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
 
JelcinCommented:
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
 
JelcinCommented:
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

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now