Table of Contents
lps - show process data
lps [ -s ] [ -c ] [ -u ] [ -t ] [ -U ]
[ -L proclimit] [ min-uid [ max-uid ] ]
lps shows process data in SPACE separated columns and is primarily
designed to be used in scripts.
With "min-uid" and "max-uid" a range of effective user ids of processes can
be specified.
The twelve columns of lps output are:
- age
- The process age (default unit: minutes). It’s the difference between
uptime and starttime in seconds. Starttime in seconds is starttime of /proc/self/stat
(value #21) divided by HZ (jiffies or ticks per second). HZ is calculated
by dividing starttime(self) by uptime. Don’t mix process age up with the
actual "running time"!
- pid
- The process ID.
- user
- The user name of the effective
user id. If the user name cannot be retrieved then the effective user id
is printed.
- RSS
- The resident set size in KB, taken from /proc/pid/stat.
- VPID
- The virtual process ID, taken from /proc/pid/stat. On systems not
supporting VPID "0" will be printed.
- CTID/FNID
- The virtual private server
ID (OpenVZ), taken from /proc/pid/stat. On systems not supporting CTID "0"
will be printed.
- procname
- The name of the process as shown in /proc/pid/stat.
- sockusage
- If the process has at least one open socket then "socket" will
be printed in this column.
- root
- The (ch)root of the process in fs as shown
in /proc/pid/root.
- cwd
- The working dir of the process in fs as shown in
/proc/pid/cwd.
- exe
- The file executable of the process as shown in /proc/pid/exe.
- cmdline
- The complete process command line as shown in /proc/pid/cmdline.
- -s
- Show process age in seconds instead of minutes.
- -c
- Suppress
normal output. Show total count of processes.
- -u
- Suppress normal output. Show
up to 3 users with topmost process counts.
- -t
- Also look for threads and
show/count them.
- -U
- Search every /proc/PID/environ for an environment variable
HTTP_USER_AGENT. If found, show it after "cmdline" at the end of every output
line and prefixed with "HTTP_USER_AGENT=". It’s useful to quickly discover
"crawler attacks" on webservers.
- -L proclimit
- Suppress normal output. Show
top user if top user’s procs count reaches proclimit.
nagios-check-longuserprocesses(1)
http://downloads.tuxad.de/
Show process data with effective user
id >= 1 (all processes except root processes) and sort output by process
age: $ lps 1 | sort -n
Step through process list:
$ lps -s 10000|while read AGE PID USER RSS VPID
CTID PROCNAME MUCHMOREVARS;do if [ $AGE ...
The maximum internal absolute pathname length is 16384 chars.
Frank
Bergmann, http://www.tuxad.com
Table of Contents