Monitoring Running Processes
The ps command may be used to monitor the processes running on the deepOfix server. Without options, it shows the processes running under the current shell.
root@hostname:directory# ps PID TTY TIME CMD 2937 pts/0 00:00:00 bash 3089 pts/0 00:00:00 ps root@hostname:directory#
You can use the u option to show the output in a user friendly format. The x and a options can be used to include many more processes to the list displayed. The list is rather large. For brevity, only the first 20 lines and the last 20 lines are shown. For each process, the user (owner of the process), the process id (PID), the percentage CPU usage(%CPU), the percentage memory usage (%MEM), the virtual memory size (VSZ), the terminal device name (TTY), the start time(START) and the CPU time (TIME) are shown below.
root@hostname:directory# ps aux | head -20 USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 100 20 tty1 Ss+ 14:51 0:02 runit root 2 0.0 0.0 0 0 ? S 14:51 0:00 [migration/0] root 3 0.0 0.0 0 0 ? SN 14:51 0:00 [ksoftirqd/0] root 4 0.0 0.0 0 0 ? S 14:51 0:00 [migration/1] root 5 0.0 0.0 0 0 ? SN 14:51 0:00 [ksoftirqd/1] root 6 0.0 0.0 0 0 ? S 14:51 0:00 [migration/2] root 7 0.0 0.0 0 0 ? SN 14:51 0:00 [ksoftirqd/2] root 8 0.0 0.0 0 0 ? S 14:51 0:00 [migration/3] root 9 0.0 0.0 0 0 ? SN 14:51 0:00 [ksoftirqd/3] root 10 0.0 0.0 0 0 ? S< 14:51 0:00 [events/0] root 11 0.0 0.0 0 0 ? S< 14:51 0:00 [events/1] root 12 0.0 0.0 0 0 ? S< 14:51 0:00 [events/2] root 13 0.0 0.0 0 0 ? S< 14:51 0:00 [events/3] root 14 0.0 0.0 0 0 ? S< 14:51 0:00 [khelper] root 15 0.0 0.0 0 0 ? S< 14:51 0:00 [kthread] root 21 0.0 0.0 0 0 ? S< 14:51 0:00 [kblockd/0] root 22 0.0 0.0 0 0 ? S< 14:51 0:00 [kblockd/1] root 23 0.0 0.0 0 0 ? S< 14:51 0:00 [kblockd/2] root 24 0.0 0.0 0 0 ? S< 14:51 0:00 [kblockd/3
The lines above show information about background processes or daemons. These are processes enclosed in square brackets [ and ]. The last 20 lines of the same command are shown below:
root 2833 0.0 0.3 18620 7040 ? Ss 14:52 0:00 apache2 -DNO_DETACH qmails 2834 0.0 0.0 1604 372 ? S 14:52 0:00 qmail-send root 2847 0.0 0.0 3152 792 ? S 14:52 0:00 qmail-lspawn ./Maildir/ qmailr 2848 0.0 0.0 1568 340 ? S 14:52 0:00 qmail-rspawn qmailq 2849 0.0 0.0 1564 328 ? S 14:52 0:00 qmail-clean qmails 2850 0.0 0.0 1588 356 ? S 14:52 0:00 qmail-todo qmailq 2851 0.0 0.0 1564 332 ? S 14:52 0:00 qmail-clean root 2864 0.0 0.0 9148 980 ? S 14:52 0:00 smbd -F www-data 2866 0.0 0.2 18812 5548 ? S 14:52 0:00 apache2 -DNO_DETACH www-data 2867 0.0 0.2 18852 5484 ? S 14:52 0:00 apache2 -DNO_DETACH www-data 2868 0.0 0.2 18852 5500 ? S 14:52 0:00 apache2 -DNO_DETACH www-data 2869 0.0 0.2 18852 5476 ? S 14:52 0:00 apache2 -DNO_DETACH www-data 2871 0.0 0.2 19008 5724 ? S 14:52 0:00 apache2 -DNO_DETACH qscand 2874 0.0 1.2 29704 25740 ? S 14:52 0:00 spamd child qscand 2875 0.0 1.2 29704 25700 ? S 14:52 0:00 spamd child www-data 2880 0.0 0.2 18820 5572 ? S 15:00 0:00 apache2 -DNO_DETACH www-data 2882 0.0 0.4 22644 8872 ? S 15:01 0:00 apache2 -DNO_DETACH root 2935 0.0 0.1 10128 3024 ? Ss 16:26 0:00 sshd: root@pts/0 root 2937 0.0 0.0 3844 1348 pts/0 Ss 16:26 0:00 -bash root 2999 0.0 0.0 2592 756 pts/0 R+ 16:47 0:00 ps aux root@hostname:directory#
As we can see, ps shows a good amount of information about processes. It has several other options which you can find from the manual page.