Tuesday, March 26, 2013

How do I list all running processes and the amount of memory/cpu each is consuming on a linux machine?

First, start off by listing the processes that are running on your machine (i.e. their names). You can do so via the following command:
ps -e
After running the above command you'll see a list of running process and their names. Find the one you're interested in (or the one you think you're interested in) and then use its name in the following command:
ps -U www-data -u www-data u
In this case we used the name 'www-data'. You should see the instances of that process listed and the percentage of memory/cpu each is using.

Lastly, you may be wondering what the 'ps' command does (other than what you've observed here). If you run the following command, you can read all about it:
man ps
Lastly (again), the 'top' command is really awesome. It does the same stuff as the commands above but in real-time:

No comments:

Post a Comment

About Me

My photo
I code. I figured I should start a blog that keeps track of the many questions and answers that are asked and answered along the way. The name of my blog is "One Q, One A". The name describes the format. When searching for an answer to a problem, I typically have to visit more than one site to get enough information to solve the issue at hand. I always end up on stackoverflow.com, quora.com, random blogs, etc before the answer is obtained. In my blog, each post will consist of one question and one answer. All the noise encountered along the way will be omitted.