DistributedNetworks DistributedNetworks

Special File Types   «Prev  Next»
Lesson 6Monitoring processes
ObjectiveUse the ps command and its arguments to monitor running processes on the system.

Monitoring processes(Use ps command)

ps command

The principal tool for monitoring processes on your system is the ps command. This command lists the running processes, together with useful information about their status.
Use the ps command by itself to get a brief list of processes owned by the user who invoked the command. Like ls, the ps command has myriad options. Let’s look at two particularly useful ones.
To obtain information on all processes on a system, use the command ps aux. On Solaris and AIX, the corresponding command is ps –ef, and the output has a slightly different form. The relevant information is still there.
To obtain information on parent-child relationships, use the command ps aj.
Unix process ID
  1. The process ID
  2. The terminal to which the process is attached
  3. A status indicator
  4. The accumulated CPU time
  5. The command line which started the process
  6. The owner of the process
  7. Daemon processes have no controlling terminal (TTY is ?)
  8. Login shells have an initial
  9. Processes that are swapped out are marked in parentheses
  10. Parent process IDs
  11. User ID numbers
using-ps-command Click the View MouseOver button to take a look at the output of the ps, ps aux, and ps aj commands. Notice how they differ and what type of information the output of each contains.
Notice that in the ps aj command output, you can obtain information about parent-child relationships. Parent process IDs are in the PPID column. This version of the ps command shows user ID numbers, not names, in the UID column. You can find your user ID number with the id command.
Sometimes, keeping track of your real identity is difficult. The whoami command will tell you the real user ID of your shell.
Let us practice using the ps commands to monitor processes. Click the Start Simulation button to get started.