Thursday, December 23, 2010

Linux System Monitoring Commands like " top, free, watch, df, du, vmstat, ps and renice "

In Linux there are some common commands we use for System Monitoring, Let us see one-by-one ...

To check:

Process listing
Free/available memory
Disk utilization

  1. #top : Shows combination of ps, uptime, free and updates regulary, Press "Q" to come out of it.

  2. #free -m : Shows RAM, SWAP memory utilization in human readable formate i.e. in MB

  3. #df -h : Shows disk partitions, mount points in human readable formate i.e. in MB

  4. #du -h : Shows size of every child file & folder of a parant folder

  5. #vmstat : shows info about processes, memory, paging, block I/O, traps, CPU consumption

  6. #gnome-system-monitor : Shows GUI System Monitoring Tool

  7. #runlevel : Shows Previous & current runlevel

  8. #ps -ef : This will display process status and listing with process ID.

  9. #kill -9 <PID> : Used to kill any unwanted process.

  10. #renice <Priority No.> <PID> : Used to change priority of any process. Priority number can be between 1-19, Higher the value lower the priority.

  11. #watch <Command> : Execute that command in every 2sec. defualtly, Press Ctrl+c to exit e.g.
    #watch df -h

  • Keep monitoring /tmp folder space, if it gets full then might encounter some performance issue.
  • Keep monitoring total swap space.
  • Keep monitoring /root partition space.
  • You can check CPU & Memory related info from
    #cat /proc/cpuinfo
    #cat /proc/meminfo
  • Always use ext3 file system for better disk performance. Also called as Journaling File System.
  • Remove unwanted services for better system performance. You can do this by using "chkconfig" command,
    #service <Service Name> <stop>
    #chkconfig <Service Name> <off>

    To Start any service permanently,
    #service <Service Name> <start>
    #chkconfig <Service Name> <on>

That's it for now ... I'll update this post if i'll find any thing else interesting.

_Enjoy :)

No comments:

Post a Comment