• There are many command-line utilities used in Linux routinely to monitor the system's performance.


  • There are straightforward everyday utilities, such as top, which lets you manage CPU usage and see what processes are taking up the most resources on your system.


  • There are other programs which check memory usage, input/output usage, network performance, et cetera. There are also graphical interfaces to monitoring performance.


  • Two well-known ones that ship on every system are: GNOME System Monitoring, ksysguard, and then there are other alternative and more robust methods, which are available from Linux distributions with a graphical interface.


  • But as I said, most Linux administrators tend to do a lot of work at the command line for monitoring performance and looking at various logs, et cetera, that are on the system.


  • . One of thestrengths of the Linux kernel is that you can add things at runtime and remove them when you no longer need it. These are called kernel modules.


  • It's a very robust system in Linux, and we'll talk about how that works.


  • A kernel module might have to be added to enable a new device that's added to the system, that maybe is plugged into a USB port, for example, or it might be something like a new network protocol that isn't actually running right now, but the capability is there if you load a module.


  • As far as device management goes, it's pretty complicated to make sure that when a device is added to the system or found at boot, that it's handled properly, and Linux uses something called udev, or user device as a facility in order to enable this.


  • You may already have ksysguard installed; check by doing:


  •  
    $ which ksysguardd
     
    
  • If not, you will have to install and it is recommended you use your distributor’s packaging system, as installing from source can be a little tricky due to all the development headers and libraries required.


  • On Red Hat-based systems, you need:


  •  
    $ sudo yum install ksysguard*
     
    
  • On SUSE, you will need to do:


  •  
    $ sudo zypper install kdebase4-workspace
     
    
  • On Ubuntu/Debian systems , the appropriate command is:


  •  
    $ sudo apt-get install ksysguard
     
    
  • Of course, depending on your exact Linux distribution and version, there might be some variation of these names. You should be able to find the right package name through the appropriate graphical package management utilities if necessary.


  • The following instructions should work with any version of ksysguard, but the graphical interface will vary somewhat according to version and Linux distribution.


  • Launch ksysguard. Click on File > New Worksheet and then Edit > Properties to control the number of rows and columns and the update frequency.


  • You can control what sensors you want to display by clicking on your machine name in the left pane and then dragging and dropping choices to the worksheet windows.


  • Note that you can display multiple sensors of similar type within a given window, including those of different CPU’s or cores.


  • If you have more than one machine available, you can display at the same time by selecting File > Connect Host. However, the other machine must be running a very similar version of ksysguard for this to work.


  • Linux distributions come with many standard performance and profiling tools already installed.


  • Some of them may be familiar from other UNIX-like operating systems, while others were developed specifically for Linux.


  • Many of these tools gather their information from the /proc pseudo-filesystem. There are also graphical system monitors that, while hiding many of the details, are still extremely useful. We will consider available graphical interfaces after detailing the command line utilities.


Utility Purpose Package
top Process activity, dynamically updated procps
uptime How long the system is running and the average load procps
ps Detailed information about processes procps
pstree A tree of processes and their connections psmisc (or pstree)
mpstat Multiple processor usage sysstat
iostat CPU utilization and I/O statistics sysstat
sar Display and collect information about system activity sysstat
numastat Information about NUMA (Non-Uniform Memory Architecture) numactl
strace Information about all system calls a process makes strace
Utility Purpose Package
free Brief summary of memory usage procps
vmstat Detailed virtual memory statistics and block I/O, dynamically updated procps
pmap Process memory map procps
Utility Purpose Package
iostat CPU utilization and I/O statistics sysstat
iotop I/O statistics including per process iotop
sar Display and collect information about system activity sysstat
vmstat Detailed virtual memory statistics and block I/O, dynamically updated procps
Utility Purpose Package
netstat Detailed networking statistics netstat
iptraf Gather information on network interfaces iptraf
tcpdump Detailed analysis of network packets and traffic tcpdump
wireshark Detailed network traffic analysis wireshark