Table of Contents
lps - show process data
lps [ -s ] [ -c ] [ -u ] [ -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
The twelve columns of lps output are:
- 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"!
- The process ID.
- The user name of the effective
user id. If the user name cannot be retrieved then the effective user id
- The resident set size in KB, taken from /proc/pid/stat.
- The virtual process ID, taken from /proc/pid/stat. On systems not
supporting VPID "0" will be printed.
- The virtual private server
ID (OpenVZ), taken from /proc/pid/stat. On systems not supporting CTID "0"
will be printed.
- The name of the process as shown in /proc/pid/stat.
- If the process has at least one open socket then "socket" will
be printed in this column.
- The (ch)root of the process in fs as shown
- The working dir of the process in fs as shown in
- The file executable of the process as shown in /proc/pid/exe.
- The complete process command line as shown in /proc/pid/cmdline.
- Show process age in seconds instead of minutes.
normal output. Show total count of processes.
- Suppress normal output. Show
up to 3 users with topmost process counts.
- 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.
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.
Table of Contents