Tuesday, July 28, 2009

how to check CPU and memory usage on a Linux box

I was asked this question once on a job interview. The interview was supposedly for a C++ developer role but they were considering me for a Linux/DB admin job. (Not really sure why. :)

I answered top because that was the only command I ever used on my Linux boxen. And after the interview, I remembered the uptime command.

So I finally decided to figure out what a good answer would have been in addition to those two commands.
And the winner is:


vmstat


The most important fields here are:


  • free - amount of physical memory not in use

  • id - percent of CPU time that is idle
  • wa - percent of CPU time spent waiting for IO

No comments: