pslist

Package: WA2L/edrc 1.5.57
Section: Library Commands (3)
Updated: 30 November 2008
Index Return to Main Contents

 

NAME

pslist - list selected processes

 

SYNOPSIS

edrc/bin/pslist [ -h ]

pslist [ select_opts ] [ -l | -H ]

pslist [ select_opts ] [ -H ] [ -o output_format ]

select_opts ::= [ -u user ] [ -g group ] [ -p pid ] [ -P ppid ] [ -t tty ] [ -c "command" ]

 

AVAILABILITY

WA2L/edrc

 

DESCRIPTION

list selected processes in a cross operating system compatible format.

If the long ( -l ) or the output format option ( -o fmt ) is not used, only a list of the process-ids ( PID ) of the selected processes is printed. This might be useful when a certain set of processes have to be killed in a script.

All select_opts options provided are used to select the corresponding column(s) on the process table without the need of taking care, that also other column(s) might have the identical entry.

Therefore the command to list all PIDs of user jdoe:

        ps -ef | egrep -v egrep |\ 
          egrep -e '^jdoe[^  ]+.*' |\ 
          awk '{ print $3 }'

can be replaced by:

        pslist -u jdoe

All selection option arguments ( -u, -g, -p, -P, -t, -c ) can also be regular expressions. If the selection argument contains spaces, it has to be quoted.

When no selection option is used, the whole process table is printed.

 

OPTIONS

-h
usage message.

-H
print the process table column headers depending on the output. By default the header is not printed. The header goes to stderr, while the process list output goes to stdout.

-l
long list output. When this option is used header and the columns of the process table as explained below are printed.

Therefore the -l option is equal to the command call: pslist -H -o user,group,pid,ppid,tty,command.

Columns:

USER
effective user name. This will be the textual user ID if it can be obtained, the decimal representation otherwise.

GROUP
effective group ID of the process. This will be the textual group ID if it can be obtained, the decimal representation otherwise.

PID
process ID number of the process.

PPID
parent process ID.

TTY
controlling tty (terminal).

COMMAND
command with all its arguments as a string. Modifications to the arguments may be shown. The output in this column may contain spaces.

-u username
username (USER) of the process to be selected.

-g groupname
groupname (GROUP) of the process to be selected.

-p process-id
process-id (PID) to be selected.

-P parent-process-id
parent-process-id (PPID) to be selected.

-t Tty
tty of the process (TT) to be selected.

-c "command"
command including arguments (COMMAND) of the process to be selected. The command has to be quoted, if the command selection contains spaces.

-o output_format
define the pslist output format. The output_format is a comma separated list of columns of the process table to be printed. The field names are: user, group, pid, ppid, tty, command. The output is separated by one tabulator.

To produce a nice looking output, use print_list(3) to format the output of pslist:


        pslist -l 2>&1 | print_list "\t"


or

        pslist -H -o user,pid,ppid,command 2>&1 |\
          print_list "\t"

 

ENVIRONMENT

-

 

EXIT STATUS

4
usage printed

0
no error

 

FILES

-

 

EXAMPLES

-

 

SEE ALSO

edrcintro(1), ps(3), pscount(3), pstree(1), regexintro(4), xpid(1)

 

NOTES

On Sun Solaris, only the processes related to the global zone are selected, therefore the processes of running zones on a global zone are not selected when pslist is started on the global zone. On zones the processes of the zone are listed.

Parts of the process table columns description were extracted from the ps(1) man page for procps version 2.0.7, written by Michael K. Johnson <johnsonm@redhat.com> that is distributed with RedHat Linux 7.2.

 

BUGS

pslist was successfully tested on: HPUX 11.11, HPUX 11.31, RedHat Linux 7.2, Suse Linux, Solaris 10.

 

AUTHOR

pslist was developed by Christian Walther. Send suggestions and bug reports to wa2l@users.sourceforge.net .

 

COPYRIGHT

Copyright © 2008 Christian Walther

This is free software; see edrc/doc/COPYING for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


 

Index

NAME
SYNOPSIS
AVAILABILITY
DESCRIPTION
OPTIONS
ENVIRONMENT
EXIT STATUS
FILES
EXAMPLES
SEE ALSO
NOTES
BUGS
AUTHOR
COPYRIGHT

This document was created by man2html using the manual pages.
Time: 00:14:19 GMT, March 08, 2025