When any Linux system is operating there hundreds of processes that could be running. A basic understanding of how these processes function is a great advantage to a Linux user. There are a number of ways to view these processes and the resources that they may use.
System Monitor on the Gnome desktop gives you excellent access to the workings of your computer. The graphical charts provide a quick glimpse of activity on the system and the process Listing allows you to switch between the processes that you are running, all processes and active processes. If you go to System/Administration and System Monitor you will find excellent tools to monitor your Ubuntu 8.04 system. The first tab will display you Linux Kernel, memory, CPU and available disk space.
The second tab describes the processes that are running on your system. These processes provide you with an excellent tool to see where the most memory or CPU time is going. This is great for trouble shooting.
The third tab is a easy way to glance at a graphical output showing your CPU usage, memory and network connections.
The last tab will show you how your system is partitioned.
A common method of viewing processes is by using the terminal. The ps command generates a snapshot of the currently running processes. In order to really see the whole picture three options are usually added to the command:
a shows processes used by other users
u the user format showing user names ans start times
x includes processes not started from a terminal like a daemon such as ftp
The results show several important categories;the user, PID (Process ID), % of CPU usage, % of Memory and the start time. This is an easy way to locate a process that is taking too many resources or too large a percentage of CPU and Memory on the system that can cause all other processes to be very slow. This is a good way to review your system to look for problems.
The pstree command not only shows the processes but it also shows how each process is related to other processes, a tree if you will.
Use this command to see the tree with the process ID;
This is a very interesting way to view the system processes and helps you understand how it is all working together.
The final command that is often used to view processes is the top command:
The top command is just filled with information. The upper section of the screen gives you a summary of the whole system:
uptime – how long the system has been running
users – how many users are currently logged in
tasks – the example shows 87 tasks with one running and 86 sleeping
zombie – programs that are running but are dead
CPU – user %, System %, idle % –all interesting stuff
Swap Space usage
In addition, top gives you the PID, user, etc. that the other commands do. From this information you can get a feel for what is happening on the system as well as locate bottlenecks and programs that are misbehaving.