![]() |
![]() |
| |||||||||||||||||||||||||||||||||||||
Example--Listing ProcessesThe following example shows output from the ps command when no options are used.
The following example shows output from ps -ef. This output shows that the first process that is executed when the system boots is sched (the swapper) followed by the init process, pageout, and so on.
The /proc File System and CommandsYou can display detailed information about the processes listed in the /proc directory by using process commands. The /proc directory is also known as the process file system (PROCFS). Images of active processes are stored here by their process ID number. The process tools are similar to some options of the ps command, except that the output that is provided by these commands is more detailed. In general, the process commands do the following:
Managing Processes With /proc Process CommandsYou can display detailed, technical information about or control active processes by using some of the process commands. Table 23-3 lists some of the /proc commands. If a process becomes trapped in an endless loop, or if it takes too long to execute, you might want to stop (kill) the process. For more information about stopping processes using the pkill command, see Chapter 23, Managing System Processes (Tasks). The /proc file system is a directory hierarchy that contains additional subdirectories for state information and control functions. The /proc file system also provides a watchpoint facility that is used to remap read and write permissions on the individual pages of a process's address space. This facility has no restrictions and is MT-safe. Debugging tools have been modified to use /proc's watchpoint facility, which means that the entire watchpoint process is faster. The following restrictions have been removed when setting watchpoints by using the dbx debugging tool:
For more information, see proc(4), core(4), and mdb(1). Table 23-3 /proc Process Commands
For more information, see proc(1).
|
# pgrep process |
process is the name of the process you want to display more information about.
The process ID is displayed in the first column of the output.
Display the process information you need.
# /usr/bin/pcommand pid |
pcommand | Process tool command that you want to run. Table 23-3 lists these commands. |
pid | Indicates the process ID. |
The following example shows how to use process tool commands to display more information about an lpsched process.
# pgrep lpsched 1
213
# pwdx 213 2
213: /
# ptree 213 3
213 /usr/lib/lpsched
# pfiles 213 4
213: /usr/lib/lpsched
Current rlimit: 4096 file descriptors
0: S_IFIFO mode:0000 dev:270,0 ino:67 uid:0 gid:0 size:0
O_RDWR
1: S_IFIFO mode:0000 dev:270,0 ino:67 uid:0 gid:0 size:0
O_RDWR
3: S_IFCHR mode:0666 dev:136,0 ino:35882 uid:0 gid:3 rdev:21,0
O_WRONLY FD_CLOEXEC
4: S_IFDOOR mode:0444 dev:275,0 ino:18526 uid:0 gid:0 size:0
O_RDONLY|O_LARGEFILE FD_CLOEXEC door to nscd[208]
5: S_IFREG mode:0664 dev:136,0 ino:64648 uid:71 gid:8 size:0
O_WRONLY
|
Obtains the process identification number for lpsched
Displays the current working directory for lpsched
Displays the process tree that containslpsched
Displays fstat and fcntl information
Previous Contents Index Next ![]() |