This chapter describes the following topics..
After your system interprets each command, the system creates an independent process with a unique process identification number (PID) to perform the command. The system uses the PID to track the current status of each process.
Use the ps command to see what processes are currently running.The ps command shows the process identification number (listed under PID) for each process you own, which is created after you type a command. This command also shows you the terminal from which it was started (TTY), the cpu time it has used so far (TIME), and the command it is performing (COMMAND).
If you add the -l option to the ps command, the system displays other process information, including the state of each running process (listed under S). The following list defines the codes used to describe processes.
O – Process is running on a processor
Note that while ps is running, the status of an individual process can change. Since the ps command gives you only a snapshot of what's going on at the moment you issue the command, the output is only accurate for a split second after you type the command.
The ps(1) command has more options than those covered here. Refer to the man Pages(1): User Commands.
Most window environments have a tool for managing processes. See the tool's online help if you need information on using it.
You can use the pgrep and pkill commands to identify and stop command processes that you no longer want to run. These commands are useful when you mistakenly start a process that takes a long time to run.
To terminate a process:
The following example illustrates how to find all the processes with a specific name (xterm) and terminate the xterm process that was started last.
$ pgrep xterm 17818 17828 17758 18210 $ pkill -n 18210 $
$ pkill -9 -n xterm
Because space on the disk is a limited resource, make sure that you know the amount of space currently in use.
The df -k command displays the amount of space currently in use on each disk mounted (directly accessible) to your system. For the capacity of each disk mounted on your system, the amount of space available, and the percentage of space in use, use the df -k command.
$ df -k
If the output of the df -k command indicates your file systems are at or above 90 percent capacity, clear unnecessary files. Clear the files by moving them to a disk or tape, using cp to copy files and mv to move them, or removing files with the rm command. Perform these kinds of “housekeeping” chores only on files that you own.
du shows you the disk usage in each subdirectory. For a list of subdirectories in a file system, change the directory to the path name that is associated with that file system. Then run the following pipeline:
$ du | sort -r -n
This pipeline, which uses the reverse (-r) and numeric (-n) options of the sort command, identifies large directories. Use ls -l to examine the size (in bytes) and modification times of files within each directory. Old files and text files larger 100 KBytes might warrant storage offline.