Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am connected to my server via SSH and would like to find out what's bogging it down so much. What commands should I run from the command line that will tell me which applications are being run and which ones are using up the most resources?

I think my server is running Ubuntu.

share|improve this question

4 Answers 4

up vote 5 down vote accepted

If you are running a *nix (you did say you thought you were running ubuntu) try using the command

top

if you want to change the way some of the information is presented to you just run

man top

and that should pull up the help file.

The command

ps aux

is also handy for finding out what is running on your server.

share|improve this answer

htop is good, you might need to get the package via the package manager

share|improve this answer

Using ps and a little command-line fu you can sort processes by CPU usage:

ps -Ao pcpu,pid,args | sort -r -k1

if you'd like to be able to page through it:

ps -Ao pcpu,pid,args | sort -r -k1 | less

Example output:

%CPU   PID COMMAND
 4.4  5229 perl -e print 1 while 1
 0.2  5202 sshd: root@pts/0
 0.1  5205 -bash
 0.0     9 [events/1]
 0.0   936 [kedac]
 0.0     8 [events/0]
 0.0     7 [watchdog/1]
 0.0     6 [ksoftirqd/1]
 0.0     5 [migration/1]
 0.0  5232 less
 0.0  5231 sort -r -k1
 0.0  5230 ps -Ao pcpu,pid,args
 0.0     4 [watchdog/0]
 0.0   454 /sbin/udevd -d
 0.0   421 [kauditd]
 0.0  4049 /usr/sbin/pure-uploadscript -B -r /root/handler.sh
 0.0  4046 pure-ftpd (SERVER)
 0.0     3 [ksoftirqd/0]
 0.0   395 [kjournald]
share|improve this answer
    
Oooh, I like, thanks for posting. I changed the pipe to less to be "grep -v '^ 0.0'" to get rid of all the processes not worth mentioning. –  Andy Lester Jun 28 '10 at 18:40
    
Also, need to add --numeric to the sort to get proper sorting. –  Andy Lester Jun 28 '10 at 18:41
    
Usually I just grab the first 10 with head as one of them is the culprit I'm looking for. The issue with using -n to sort is that the header will be moved down, using it without has always sorted it for me properly asciibetically. Modify it according to your fancy. I have a similar command aliased to "hogs" :) –  John T Jun 28 '10 at 18:44

(h)top gives you CPU usage and memory. You can also use iotop for disk read/write, and other IO stuff. Probably not installed by default, so run sudo apt-get install iotop first..

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.