PDA

View Full Version : How to check CPU load in command line


Swiss2K
July 28th, 2006, 04:36 AM
I've an Ubuntu server running with no desktop. Is there a way to check the CPU load (and maybe also network load) in command line?

If there is no tool in command line, I’m willing to install Xfce. Does Xfce Standard come with a cpu monitor?

Appreciate any help:D

paul.maddox
July 28th, 2006, 05:50 AM
top displays all sorts of CPU/Memory/Process information.

I believe that there is also ntop for monitoring network stuff but I've never used this myself.

free -m will show you stats about RAM usage in MB

uptime will show you the load average for the past 1min, 5mins and 15mins

cat /proc/cpuinfo will give you general information about the CPU(s)

A great program for monitoring network traffic is iptraf which is in the repositories.

Swiss2K
July 28th, 2006, 08:51 AM
Thank you very much!

lamego
July 28th, 2006, 09:46 AM
Installing the sysstat package and using the "sar" command is also a very good option.

Kurt`
July 28th, 2006, 11:59 AM
Installing the sysstat package and using the "sar" command is also a very good option.
I apt-get install'ed sysstat, and sar returns this:

# Cannot open /var/log/sysstat/sa28: No such file or directory

Shouldn't that directory be created when it's installed?

fdoving
July 29th, 2006, 12:52 PM
I use 'htop' and i like it.
It's in universe.

- Frode

paul.maddox
July 29th, 2006, 01:17 PM
htop gets a thumbs up from me, never seen it before but it looks much nicer than top.

Kurt`
July 29th, 2006, 05:12 PM
Wow, htop is really cool!

bicchi
September 11th, 2006, 07:29 PM
I apt-get install'ed sysstat, and sar returns this:

# Cannot open /var/log/sysstat/sa28: No such file or directory

Shouldn't that directory be created when it's installed?
Happened to me also. Just reconfigure the application from the command line and it will work. You can have it start from /etc/init.d and uninstall it when you will not longer use it.

For now just type:

sudo dpkg-reconfigure sysstat

rastilin
September 11th, 2006, 10:42 PM
I'm surprised no one's mentioned vmstat. Type "vmstat #" and you'll get a run down of memory use, disk operations and cpu usage every # seconds. The first line's a running average.

paul.maddox
September 12th, 2006, 08:05 AM
Can you just give a quick explanation of what the various columns represent in vmstat and which ones we should be looking at to determin different performance problems?

ruedu
September 12th, 2006, 09:51 AM
Can you just give a quick explanation of what the various columns represent in vmstat and which ones we should be looking at to determin different performance problems?


type man vmstat

mobilehavoc
September 12th, 2006, 10:52 AM
Nice. htop is great. Just ssh'd into my box, apt-get installed it and ran it...remote monitoring FTW!

etcpool
September 20th, 2006, 04:10 AM
htop is cool!!!! :D ;)

karsteb
August 16th, 2007, 11:32 AM
I'm surprised no one's mentioned vmstat. Type "vmstat #" and you'll get a run down of memory use, disk operations and cpu usage every # seconds. The first line's a running average.

I apt-get install'ed sysstat, and sar returns this:

# Cannot open /var/log/sysstat/sa28: No such file or directory

Shouldn't that directory be created when it's installed?


Sar needs to be enabled before it can be used. I agree that the error message is completely uselsess, but anyways:

Enable sysstat data collection by doing

# dpkg-reconfigure sysstat

or manually by changing value of ENABLED from "false" to "true" in /etc/default/sysstat

Then start sysstat by doing

# /etc/init.d/sysstat start

Check var/log/sysstat/ and you will find the file that were missing.

Run

$ sar

netlogic
August 16th, 2007, 02:54 PM
Also, it is good to understand how to read the /proc
There are plenty of docs on the net explain about the /proc