Home Explore Blog CI



man-pages

2nd chunk of `ps.man`
0881eb69507a94a550e4d3bf8ee8b799880a345835019fa30000000100000fa8
 system using standard syntax:
          ps -e
          ps -ef
          ps -eF
          ps -ely

       To see every process on the system using BSD syntax:
          ps ax
          ps axu

       To print a process tree:
          ps ‐ejH
          ps axjf

       To get info about threads:
          ps ‐eLf
          ps axms

       To get security info:
          ps ‐eo euser,ruser,suser,fuser,f,comm,label
          ps axZ
          ps ‐eM

       To see every process running as root (real & effective ID) in user
       format:
          ps -U root -u root u

       To see every process with a user-defined format:
          ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm
          ps axo stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm
          ps -Ao pid,tt,user,fname,tmout,f,wchan

       Print only the process IDs of syslogd:
          ps -C syslogd -o pid=

       Print only the name of PID 42:
          ps -q 42 -o comm=

SIMPLE PROCESS SELECTION
       a      Lift the BSD-style "only yourself" restriction, which is  imposed
              upon  the  set of all processes when some BSD-style (without "-")
              options are used or when the ps personality setting is  BSD-like.
              The  set  of  processes selected in this manner is in addition to
              the set of processes  selected  by  other  means.   An  alternate
              description  is  that this option causes ps to list all processes
              with a terminal  (tty),  or  to  list  all  processes  when  used
              together with the x option.

       -A     Select all processes.  Identical to -e.

       -a     Select  all processes except both session leaders (see getsid(2))
              and processes not associated with a terminal.

       -d     Select all processes except session leaders.

       --deselect
              Select all processes except  those  that  fulfill  the  specified
              conditions (negates the selection).  Identical to -N.

       -e     Select all processes.  Identical to -A.

       g      Really  all, even session leaders.  This flag is obsolete and may
              be discontinued in a future release.  It is normally  implied  by
              the  a  flag,  and  is  only  useful when operating in the sunos4
              personality.

       -N     Select all processes except  those  that  fulfill  the  specified
              conditions (negates the selection).  Identical to --deselect.

       T      Select all processes associated with this terminal.  Identical to
              the t option without any argument.

       r      Restrict the selection to only running processes.

       x      Lift  the  BSD-style  "must  have  a  tty"  restriction, which is
              imposed upon  the  set  of  all  processes  when  some  BSD-style
              (without "-") options are used or when the ps personality setting
              is  BSD-like.  The set of processes selected in this manner is in
              addition to the set of processes selected  by  other  means.   An
              alternate  description  is that this option causes ps to list all
              processes owned by  you  (same  EUID  as  ps),  or  to  list  all
              processes when used together with the a option.

PROCESS SELECTION BY LIST
       These  options accept a single argument in the form of a blank-separated
       or comma-separated list.  They can be used multiple times.  For example:
       ps -p "1 2" -p 3,4

       -123   Identical to --pid 123.

       123    Identical to --pid 123.

       -C cmdlist
              Select  by  command  name.   This  selects  the  processes  whose
              executable  name  is given in cmdlist.  NOTE: The command name is
              not the same as the command line. Previous versions of procps and
              the kernel truncated this command name  to  15  characters.  This
              limitation  is  no  longer  present  in

Title: ps - Examples and Simple Process Selection
Summary
This section provides examples of how to use `ps` to view processes in different ways, including standard and BSD syntax, printing process trees, getting thread and security information, and using user-defined formats. It then details simple process selection options such as `-a`, `-A`, `-e`, `-d`, `-N`, `-T`, `-r`, and `-x`, which allow filtering processes based on terminal association, session leadership, running state, and BSD-style restrictions. Additionally, it covers process selection by list, allowing selection based on process ID or command name using options like `-C` and `-p`.