ps man

2:28:00 PM 0 Comments

SYNOPSIS

ps [-Aacdefjl] [-S hostname] [-G idlist] [-g grouplist] [-n name] [-o format] ... [-p proclist] [-s idlist] [-t termlist] [-U|u userlist]


DESCRIPTION

ps displays information about processes, provided that you have appropriate privileges to obtain information about the requested processes.

Options

ps accepts several options. When a description says that ps lists all processes, it means all the processes on the system, provided that you have appropriate privileges.

-A

displays information on all accessible processes. You can specify -A, -a, and -e in any combination, however, -a overrides both -A and -e.

-a

displays information on all processes associated with terminals. You can specify -A, -a, and -e in any combination; however, -a overrides both -A and -e.

-c

displays more detailed information about processes for the -f and -l options. Accepted but not currently implemented.

-d

displays information for all processes except group leaders.

-e

displays information on all accessible processes. You can specify -A, -a, and -e in any combination; however, -a overrides both -A and -e.

-f

displays information as if the user specified

-o ruser=UID -o pid,ppid,pcpu=C -o stime,tty=TTY -o atime,args
-G idlist

displays information on processes with process group numbers in idlist. Separate numbers in idlist with either blanks or commas.

-g grouplist

displays information on processes with real group ID numbers in grouplist. Separate numbers in grouplist with either blanks or commas.

-j

displays information as if the user specified

-o pid,sid,pgid=PGRP -o tty=TTY -o atime,comm
-l

displays information as if the user specified

-o ruser=USER -o pid,ppid,pri,vsz=SIZE -o rss,stime=START -o atime,args=CMD
-n name

specifies the name of the executable containing the kernel symbol table.

-o format

displays information according to the given format specifications. For further information, see Format Specifications.

-p proclist

displays information for processes with process ID numbers in proclist. Separate numbers in proclist with either blanks or commas.

-S hostname

displays information for processes running on the remote system hostname. The remote system must be a Windows NT/2000/XP/2003/Vista system and you must have administrator privileges on that system. To obtain the process information, ps installs a service named psproxy on the remote system (if it isn't already installed) and communicates with that service.

-s idlist

displays information for processes with session ID numbers in idlist. Separate numbers in idlist with either blanks or commas.

-t termlist

displays information for processes with terminals in termlist. You denote terminals in termlist with either the file name of the device (for example, tty04), or if the file name begins with tty, you can simply specify the characters following tty. For example, tty04 and 04 both denote the same terminal. Terminals in termlist are separated by either blanks or commas.

-U userlist
-u userlist

displays information for processes with user IDs in userlist. Items in userlist can be user ID numbers or login names, and are separated by either blanks or commas.

Format Specifications

The format specified with -o is a list of names separated with blanks or commas. At the beginning of the output display, ps displays column headings to tell you what you are seeing. For example, if you specify ruser (indicating that you want to see real user names), ps normally puts the heading RUSER at the top of the column that shows real user names.

If you do not specify the -o option, ps displays the information as though you specified

-o pid,tty=TTY -o atime,comm=CMD

The following list shows the names that ps recognizes. At the end of each description, we put the default column heading inside square brackets. The following names are POSIX-compliant.

args

displays the command that is executing, with all its arguments. [COMMAND]

Note:

The arguments for a command can only be displayed if ps is run from an account that is either part of the Administrators group or has the SeDebugPrivilege privilege set.

comm

displays the name of the command that is executing. This string is padded on the right if necessary. [COMMAND]

etime

displays the amount of real time that has elapsed since the process began execution. ps shows the time in the form:

[[dd-]hh:]mm:ss

where dd is the number of days, hh is the number of hours, mm is the number of minutes, and ss is the number of seconds. [ELAPSED]

group

displays the effective group ID of the process, as a group name if possible and as a decimal group ID if not. [GROUP]

nice

displays the nice value (urgency) of the process as a decimal value. [NI]

pcpu

displays a percentage value giving the ratio of CPU time used to CPU time available. This option is unsupported and always returns a value of 0. [%CPU]

pgid

displays the process group ID as a decimal value. [PGID]

pid

displays the process ID as a decimal value. [PID]

ppid

displays the parent process ID as a decimal value. [PPID]

rgroup

displays the real group ID of the process, as a group name if possible and as a decimal group ID if not. [RGROUP]

ruser

displays the real userid of the process, as a username if possible and as a decimal user ID otherwise. [RUSER]

time

displays the amount of CPU time that the process has used since it began execution. ps displays this time in form similar to that used by etime. [TIME]

tty

displays the name of the controlling terminal (if any). On NT, this name is always "conin$", which is actually the source which initiated the process. [TT]

user

displays the effective userid of the process, as a username if possible and as a decimal user ID otherwise. [USER]

vsz

displays the amount of (virtual) memory that the process is using, as a decimal number of kilobytes. [VSZ]

The following names are MKS Toolkit extensions to ps.

addr

displays the address of the process. [ADDR]

atime

displays the abbreviated CPU time of the process. [TIME]

domainuser

displays the user name including the domain (for example, TESTDOMAIN/Robin) when the user is a domain user. [USER]

flags

displays the process flags. [F]

gid

displays the effective group ID of the process. [EGID]

pri

displays the process priority. [PRI]

rgid

displays the real group ID of the process. [GID]

rss

displays the resident set size of the process. This is the amount of physical memory actually used by the process.

ruid

displays the real user ID of the process. [UID]

sid

displays the session ID of the process. [SID]

state

displays the process state. [S]

stime

displays the start time of the process. [STIME]

uid

displays the effective user ID of the process. [EUID]

wchan

displays the channel upon which the process is waiting. [WCHAN]

xpid

displays the process ID in hexadecimal.

If you want to specify your own column heading instead of the defaults, put

=heading

after the name in the format list. For example,

ps -o args,ruser=WHO

displays the command and the real user name. The heading for the command column is the default COMMAND but the heading for the user name column is WHO. If you specify = with no heading, ps displays that column without a heading. If all columns have no heading, ps displays no heading line.


ENVIRONMENT VARIABLES

TK_UNIX_FILESYSTEM

When this variable is set, the Enhanced UNIX Compatibility Mode is on and the virtual file system is in use.

ps displays command lines as they were entered. This environment variable has no effect on that display. For example, a command line entered when the Enhanced UNIX Compatibility Mode was on, and then displayed by ps when that mode is off will still be displayed with virtual file system path names (if any). Similarly, Windows path names entered when the Enhanced UNIX Compatibility Mode is off will still be displayed as Windows path when ps is run with the Enhanced UNIX Compatibility Mode off.

For details on the Enhanced UNIX Compatibility Mode and the virtual file system, see the EUCM reference page.


DIAGNOSTICS

Possible exit status values are:

0

Successful completion.

1

Failure due to any of the following:

— the inability to open the process table
2

Usage error, including any of the following:

— unknown command line option
— missing format string after -o
— missing lists after other options
— too many arguments on the command line

Some say he’s half man half fish, others say he’s more of a seventy/thirty split. Either way he’s a fishy bastard.