Processes

ps and similar utilities are core tools for system administration.

Common features of ps implementations

Common flags

-u UID

-p PID

-t TTY

-e (every)

-f (full)

-w (wide)

-o options

System V vs BSD syntax

System V syntax uses minus, the BSD syntax doesn't.

The latter has fewer options.

Unix (AIX) ps

The AIX ps has a few unique features, most notably these:

-T (tree display)

-@ (WPAR selection)

Help

[gabor@aix] ~ $ ps -h
ps: Not a recognized flag: h
Usage: ps [-AMNZaedfklm] [-n namelist] [-F Format] [-o specifier[=header],...]
                [-p proclist][-G|-g grouplist] [-t termlist] [-U|-u userlist] [-c classlist] [ -T pid] [ -L pidlist ]
                [-@ [wparname] ]
Usage: ps [aceglnsuvwxX] [t tty] [processnumber]

GNU ps and the procps package

GNU ps has long options and generally a richer function set than other implementations.

Help

gabor@linux:~> ps --help
********* simple selection *********  ********* selection by list *********
-A all processes                      -C by command name
-N negate selection                   -G by real group ID (supports names)
-a all w/ tty except session leaders  -U by real user ID (supports names)
-d all except session leaders         -g by session OR by effective group name
-e all processes                      -p by process ID
T  all processes on this terminal     -s processes in the sessions given
a  all w/ tty, including other users  -t by tty
g  OBSOLETE -- DO NOT USE             -u by effective user ID (supports names)
r  only running processes             U  processes for specified users
x  processes w/o controlling ttys     t  by tty
*********** output format **********  *********** long options ***********
-o,o user-defined  -f full            --Group --User --pid --cols --ppid
-j,j job control   s  signal          --group --user --sid --rows --info
-O,O preloaded -o  v  virtual memory  --cumulative --format --deselect
-l,l long          u  user-oriented   --sort --tty --forest --version
-F   extra full    X  registers       --heading --no-heading --context
                    ********* misc options *********
-V,V  show version      L  list format codes  f  ASCII art forest
-m,m,-L,-T,H  threads   S  children in sum    -y change -l format
-M,Z  security data     c  true command name  -c scheduling class
-w,w  wide output       n  numeric WCHAN,UID  -H process hierarchy

pgrep, pkill

pgrep/pkill comes from Solaris and is also part of the GNU/Linux procps package ("pkill and pgrep were introduced in Sun's Solaris 7. This implementation is fully compatible.").

Help

gabor@linux:~> pgrep -h
pgrep: invalid option -- 'h'
Usage: pgrep [-flvx] [-d DELIM] [-n|-o] [-P PPIDLIST] [-g PGRPLIST] [-s SIDLIST]
        [-u EUIDLIST] [-U UIDLIST] [-G GIDLIST] [-t TERMLIST] [PATTERN]

pidof, pidofproc

...

AIX specific process tools

proccred(1) - Prints the credentials (effective, real, saved user IDs and group IDs)of processes.

procfiles(1) - Reports information about all file descriptors opened by processes.

procflags(1) - Prints the /proc tracing flags, the pending and held signals, and other /proc status information for each thread in the specified processes.

procldd(1) - Lists the objects loaded by processes, including shared objects explicitlyattached using dlopen().

procmap(1) - Prints the address space map of processes.

procrun(1) - Starts a process that has stopped on the PR_REQUESTED event.

procsig(1) - Lists the signal actions defined by processes.

procstack(1) - Prints the hexadecimal addresses and symbolic names for all the threadsin the process.

procstop(1) - Stops processes on the PR_REQUESTED event.

proctree(1) - Prints the process tree containing the specified process IDs orusers.

procwait(1) - Waits for all of the specified processes to terminate.

Process monitors: top, topas, nmon, htop

GNU/Linux and BSD variants have slightly different implementations of top. AIX 5.x has topas, but in the last few years nmon (the versatile system monitor of Nigel Griffiths) is also included in the base system.

I like htop on Linux which gives a detailed view of load on individual cores/threads and can display process threads or display a tree structure of the running processes.

Signals, kill, killall

...

Windows tasklist/taskkill

I would like to mention it here, just to make the list complete.

These are the rough equivalent of pgrep/pkill for the Windows OS. These are commandline tools. See also Sysinternals Process Explorer, a free graphical tool endorsed by Microsoft.

http://technet.microsoft.com/en-us/sysinternals/bb896653