Obtaining Miscellaneous Information

Although ps and top provide a great deal of useful information, there are additional tools for learning about processes. These tools include:

pstree This program creates a process tree diagram, similar to what ps produces with its -H, f, or -forest options.

w This very short command displays load averages and information on resource use by user, including login time, idle time, cumulative CPU time used, and what process the user is currently running. If a user opens several xterm windows or run several remote login sessions, that user will appear in the w output several times.

jobs If you suspend a process by typing Ctrl+Z while it's running in a terminal, you may forget that it's suspended. If you're not sure if a terminal has any suspended processes, you can type jobs to find out. If there are no suspended processes, this command produces no output. If there are suspended processes, it names them. You can return to a suspended process by typing fg, optionally followed by a job ID number if you've suspended more than one process. (The job ID number is displayed by job and is not the same as a process ID number.)

Isof This program displays information on open files, including the filename, the PID of the process accessing the file, the name of the process accessing the file, and the user running the program. This command can be extremely useful if you can't unmount a removable disk because it's in use; type Isof | grep /mount/point (where /mount/point is where the disk is mounted) to learn what processes are accessing files on the disk.

netstat This program produces a plethora of information on network interfaces and connections. Of particular interest to this chapter is the-p option, which causes netstat to display the names of processes that are making network accesses, in addition to network-specific information such as socket numbers.

Both Isof and netstat tend to produce a lot of output, so they're best used in conjunction with less or grep to peruse the output or trim it if you know for what you're looking.

0 0

Post a comment