プロセスを確認するpsコマンドの使い方をまとめました。
psコマンドの概要
psコマンドはLinuxで実行中のプロセス(Process)を確認できるコマンドです。
以下をRed Hat Enterprise Linux 9.5で実行するとpsコマンドのより詳しい説明を確認できます。
man ps
上記のコマンドの実行結果から確認できるpsコマンドのマニュアルを一部抜粋して日本語に翻訳したものが以下になります。
例
標準構文を使用してシステム上のすべてのプロセスを表示するには、次のようにします。
To see every process on the system using standard syntax:
ps -e
ps -ef
ps -eF
ps -ely
BSD 構文を使用してシステム上のすべてのプロセスを表示するには
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
ユーザーの root (実際の有効な ID) として実行されているすべてのプロセスを確認する
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
syslogd のプロセス ID のみを出力します。
Print only the process IDs of syslogd:
ps -C syslogd -o pid=
PID 42 の名前のみを出力します。
Print only the name of PID 42:
ps -q 42 -o comm=
man psコマンドで確認できるマニュアルからpsコマンドのオプションをまとめました。
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 BSD スタイルの「自分だけ」制限を解除します。この制限は、BSD スタイル (「-」なし) オプションが使用されている場合、または ps パーソナリティ設定が BSD に似ている場合に、すべてのプロセスのセットに課せられます。 この方法で選択されたプロセスのセットは、他の手段で選択されたプロセスのセットに追加されます。 別の説明では、このオプションにより ps は端末 (tty) を使用してすべてのプロセスをリストするか、または x オプションと一緒に使用するとすべてのプロセスをリストします。
-A Select all processes. Identical to -e. すべてのプロセスを選択します。 -e と同じ。
-a Select all processes except both session leaders (see getsid(2)) and processes not associated with a terminal. セッション リーダー (getsid(2) を参照) と端末に関連付けられていないプロセスを除くすべてのプロセスを選択します。
-d Select all processes except session leaders. セッション リーダーを除くすべてのプロセスを選択します。
--deselect
Select all processes except those that fulfill the specified conditions (negates the selection). Identical to -N. 指定した条件を満たすプロセスを除くすべてのプロセスを選択します(選択を無効にします)。 -N と同じ。
-e Select all processes. Identical to -A. すべてのプロセスを選択します。 -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. 本当に全員、セッションリーダーも含めて。 このフラグは廃止され、将来のリリースでは廃止される可能性があります。 これは通常、フラグによって暗示され、sunos4 パーソナリティで動作する場合にのみ役立ちます。
-N Select all processes except those that fulfill the specified conditions (negates the selection). Identical to --deselect. 指定した条件を満たすプロセスを除くすべてのプロセスを選択します(選択を無効にします)。 --deselect と同じ。
T Select all processes associated with this terminal. Identical to the t option without any argument. この端末に関連付けられているすべてのプロセスを選択します。 引数のない t オプションと同じです。
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. BSD スタイルの「tty が必要」制限を解除します。この制限は、BSD スタイル (「-」なし) オプションが使用されている場合、または ps パーソナリティ設定が BSD に似ている場合に、すべてのプロセスのセットに課せられます。 この方法で選択されたプロセスのセットは、他の手段で選択されたプロセスのセットに追加されます。 別の説明では、このオプションにより、ps はユーザーが所有するすべてのプロセス (ps と同じ EUID) をリストするか、または a オプションと一緒に使用するとすべてのプロセスをリストします。
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
これらのオプションは、空白区切りまたはカンマ区切りのリストの形式で単一の引数を受け入れます。 複数回使用できます。 例: 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 both. If you depended on matching only 15 characters, you may no longer get a match.
コマンド名で選択します。 これにより、cmdlist で指定された実行可能ファイル名のプロセスが選択されます。 注: コマンド名はコマンド ラインと同じではありません。以前のバージョンの procps とカーネルでは、このコマンド名が 15 文字に切り詰められていました。この制限はどちらにも存在しなくなりました。 15 文字のみの一致に依存している場合は、一致が得られなくなる可能性があります。
-G grplist
Select by real group ID (RGID) or name. This selects the processes whose real group name or ID is in the grplist list. The real group ID identifies the group of the user who created the process, see getgid(2).
実際のグループ ID (RGID) または名前で選択します。 これにより、実際のグループ名または ID が grplist リストにあるプロセスが選択されます。 実際のグループ ID は、プロセスを作成したユーザーのグループを識別します。getgid(2) を参照してください。
-g grplist
Select by session OR by effective group name. Selection by session is specified by many standards, but selection by effective group is the logical behavior that several other operating systems use. This ps will select by session when the list is completely numeric (as sessions are). Group ID numbers will work only when some group names are also specified. See the -s and --group options.
セッションまたは実効グループ名で選択します。 セッションによる選択は多くの標準で指定されていますが、有効なグループによる選択は他のいくつかのオペレーティング システムで使用されている論理的な動作です。 この ps は、リストが完全に数値である場合 (セッションのように) セッションごとに選択します。 グループ ID 番号は、いくつかのグループ名も指定されている場合にのみ機能します。 -s および --group オプションを参照してください。
--Group grplist
Select by real group ID (RGID) or name. Identical to -G.
--group grplist
Select by effective group ID (EGID) or name. This selects the processes whose effective group name or ID is in grplist. The effective group ID describes the group whose file access permissions are used by the process (see getegid(2)). The -g option is often an alternative to --group.
実効グループ ID (EGID) または名前で選択します。 これにより、実効グループ名または ID が grplist にあるプロセスが選択されます。 実効グループ ID は、プロセスによってファイル アクセス許可が使用されるグループを記述します (getegid(2) を参照)。 -g オプションは、多くの場合、--group の代替として使用されます。
p pidlist
Select by process ID. Identical to -p and --pid.
-p pidlist
Select by PID. This selects the processes whose process ID numbers appear in pidlist. Identical to p and --pid.
プロセスIDで選択します。 -p および --pid と同じです。
--pid pidlist
Select by process ID. Identical to -p and p.
プロセスIDで選択します。 -p および p と同じ。
--ppid pidlist
Select by parent process ID. This selects the processes with a parent process ID in pidlist. That is, it selects processes that are children of those listed in pidlist. 親プロセスIDで選択します。 これにより、pidlist 内の親プロセス ID を持つプロセスが選択されます。 つまり、pidlist にリストされているプロセスの子であるプロセスが選択されます。
q pidlist
Select by process ID (quick mode). Identical to -q and --quick-pid. プロセス ID で選択します (クイック モード)。 -q および --quick-pid と同じです。
-q pidlist
Select by PID (quick mode). This selects the processes whose process ID numbers appear in pidlist. With this option ps reads the necessary info only for the pids listed in the pidlist and doesn't apply additional filtering rules. The order of pids is unsorted and preserved. No additional selection options, sorting and forest type listings are allowed in this mode. Identical to q and --quick-pid. PIDで選択(クイックモード)。 これにより、プロセス ID 番号が pidlist に表示されるプロセスが選択されます。 このオプションを使用すると、ps は pidlist にリストされている pid についてのみ必要な情報を読み取り、追加のフィルタリング ルールを適用しません。 PID の順序はソートされずに保持されます。 このモードでは、追加の選択オプション、並べ替え、およびフォレスト タイプのリストは許可されません。 q および --quick-pid と同じです。
--quick-pid pidlist
Select by process ID (quick mode). Identical to -q and q. プロセス ID で選択します (クイック モード)。 -q および q と同じ。
-s sesslist
Select by session ID. This selects the processes with a session ID specified in sesslist. セッションIDで選択します。 これにより、sesslistで指定されたセッションIDを持つプロセスが選択されます。
--sid sesslist
Select by session ID. Identical to -s. セッションIDで選択します。 -s と同じ。
t ttylist
Select by tty. Nearly identical to -t and --tty, but can also be used with an empty ttylist to indicate the terminal associated with ps. Using the T option is considered cleaner than using t with an empty ttylist. ttyで選択します。 -t および --tty とほぼ同じですが、ps に関連付けられた端末を示すために空の ttylist とともに使用することもできます。 T オプションを使用することは、空の ttylist で t を使用するよりもクリーンであると考えられます。
-t ttylist
Select by tty. This selects the processes associated with the terminals given in ttylist. Terminals (ttys, or screens for text output) can be specified in several forms: /dev/ttyS1, ttyS1, S1. A plain "-" may be used to select processes not attached to any terminal. ttyで選択します。 これにより、ttylist で指定された端末に関連付けられたプロセスが選択されます。 ターミナル (tty、またはテキスト出力用の画面) は、/dev/ttyS1、ttyS1、S1 のようないくつかの形式で指定できます。 プレーンの「-」を使用して、どの端末にも接続されていないプロセスを選択することもできます。
--tty ttylist
Select by terminal. Identical to -t and t. 端末ごとに選択します。 -t および t と同じ。
U userlist
Select by effective user ID (EUID) or name. This selects the processes whose effective user name or ID is in userlist. The effective user ID describes the user whose file access permissions are used by the process (see geteuid(2)). Identical to -u and --user. 実効ユーザー ID (EUID) または名前で選択します。 これにより、実効ユーザー名または ID が userlist にあるプロセスが選択されます。 実効ユーザー ID は、プロセスによって使用されるファイル アクセス許可を持つユーザーを記述します (geteuid(2) を参照)。 -u および --user と同じです。
-U userlist
Select by real user ID (RUID) or name. It selects the processes whose real user name or ID is in the userlist list. The real user ID identifies the user who created the process, see getuid(2). 実際のユーザー ID (RUID) または名前で選択します。 実際のユーザー名または ID が userlist リストにあるプロセスを選択します。 実際のユーザー ID は、プロセスを作成したユーザーを識別します。getuid(2) を参照してください。
-u userlist
Select by effective user ID (EUID) or name. This selects the processes whose effective user name or ID is in userlist.
The effective user ID describes the user whose file access permissions are used by the process (see geteuid(2)). Identical to U and --user.
実効ユーザー ID (EUID) または名前で選択します。 これにより、実効ユーザー名または ID が userlist にあるプロセスが選択されます。
実効ユーザー ID は、プロセスによって使用されるファイル アクセス許可を持つユーザーを記述します (geteuid(2) を参照)。 U および --user と同じ。
--User userlist
Select by real user ID (RUID) or name. Identical to -U. 実際のユーザー ID (RUID) または名前で選択します。 -Uと同じ。
--user userlist
Select by effective user ID (EUID) or name. Identical to -u and U. 実効ユーザー ID (EUID) または名前で選択します。 -u および U と同じ。
OUTPUT FORMAT CONTROL
These options are used to choose the information displayed by ps. The output may differ by personality.
-c Show different scheduler information for the -l option.
--context
Display security context format (for SELinux).
-f Do full-format listing. This option can be combined with many other UNIX-style options to add additional columns. It also causes the command arguments to be printed. When used with -L, the NLWP (number of threads) and LWP (thread ID) columns will be added. See the c option, the format keyword args, and the format keyword comm.
-F Extra full format. See the -f option, which -F implies.
--format format
user-defined format. Identical to -o and o.
j BSD job control format.
-j Jobs format.
l Display BSD long format.
-l Long format. The -y option is often useful with this.
-M Add a column of security data. Identical to Z (for SELinux).
O format
is preloaded o (overloaded). The BSD O option can act like -O (user-defined output format with some common fields predefined) or can be used to specify sort order. Heuristics are used to determine the behavior of this option. To ensure that the desired behavior is obtained (sorting or formatting), specify the option in some other way (e.g. with -O or --sort). When used as a formatting option, it is identical to -O, with the BSD personality.
-O format
Like -o, but preloaded with some default columns. Identical to -o pid,format,state,tname,time,command or -o pid,format,tname,time,cmd, see -o below.
o format
Specify user-defined format. Identical to -o and --format.
-o format
User-defined format. format is a single argument in the form of a blank-separated or comma-separated list, which offers a way to specify individual output columns. The recognized keywords are described in the STANDARD FORMAT SPECIFIERS section below. Headers may be renamed (ps -o pid,ruser=RealUser -o comm=Command) as desired. If all column headers are empty (ps -o pid= -o comm=) then the header line will not be output.
Column width will increase as needed for wide headers; this may be used to widen up columns such as WCHAN (ps -o pid,wchan=WIDE-WCHAN-COLUMN -o comm). Explicit width control (ps opid,wchan:42,cmd) is offered too.
The behavior of ps -o pid=X,comm=Y varies with personality; output may be one column named "X,comm=Y" or two columns named "X" and "Y". Use multiple -o options when in doubt. Use the PS_FORMAT environment variable to specify a default as desired; DefSysV and DefBSD are macros that may be used to choose the default UNIX or BSD columns.
s Display signal format.
u Display user-oriented format.
v Display virtual memory format.
X Register format.
-y Do not show flags; show rss in place of addr. This option can only be used with -l.
Z Add a column of security data. Identical to -M (for SELinux).
OUTPUT MODIFIERS
c Show the true command name. This is derived from the name of the executable file, rather than from the argv value. Command arguments and any modifications to them are thus not shown. This option effectively turns the args format keyword into the comm format keyword; it is useful with the -f format option and with the various BSD-style format options, which all normally display the command arguments. See the -f option, the format keyword args, and the format keyword comm.
--cols n
Set screen width.
--columns n
Set screen width.
--cumulative
Include some dead child process data (as a sum with the parent).
e Show the environment after the command.
f ASCII art process hierarchy (forest).
--forest
ASCII art process tree.
h No header. (or, one header per screen in the BSD personality). The h option is problematic. Standard BSD ps uses this option to print a header on each page of output, but older Linux ps uses this option to totally disable the header. This version of ps follows the Linux usage of not printing the header unless the BSD personality has been selected, in which case it prints a header on each page of output. Regardless of the current personality, you can use the long options --headers and --no-headers to enable printing headers each page or disable headers entirely, respectively.
-H Show process hierarchy (forest).
--headers
Repeat header lines, one per page of output.
k spec Specify sorting order. Sorting syntax is [+|-]key[,[+|-]key[,...]]. Choose a multi-letter key from the STANDARD FORMAT SPECIFIERS section. The "+" is optional since default direction is increasing numerical or lexicographic order. Identical to --sort.
Examples:
ps jaxkuid,-ppid,+pid
ps axk comm o comm,args
ps kstart_time -ef
--lines n
Set screen height.
n Numeric output for WCHAN and USER (including all types of UID and GID).
--no-headers
Print no header line at all. --no-heading is an alias for this option.
O order
Sorting order (overloaded). The BSD O option can act like -O (user-defined output format with some common fields predefined) or can be used to specify sort order. Heuristics are used to determine the behavior of this option. To ensure that the desired behavior is obtained (sorting or formatting), specify the option in some other way (e.g. with -O or --sort).
For sorting, obsolete BSD O option syntax is O[+|-]k1[,[+|-]k2[,...]]. It orders the processes listing according to the multilevel sort specified by the sequence of one-letter short keys k1,k2, ... described in the OBSOLETE SORT KEYS section below. The "+" is currently optional, merely re-iterating the default direction on a key, but may help to distinguish an O sort from an O format. The "-" reverses direction only on the key
it precedes.
--rows n
Set screen height.
S Sum up some information, such as CPU usage, from dead child processes into their parent. This is useful for examining a system where a parent process repeatedly forks off short-lived children to do work.
--sort spec
it precedes.
--rows n
--headers
Repeat header lines, one per page of output.
k spec Specify sorting order. Sorting syntax is [+|-]key[,[+|-]key[,...]]. Choose a multi-letter key from the STANDARD FORMAT SPECIFIERS section. The "+" is optional since default direction is increasing numerical or lexicographic order. Identical to --sort.
Examples:
ps jaxkuid,-ppid,+pid
ps axk comm o comm,args
ps kstart_time -ef
--lines n
Set screen height.
n Numeric output for WCHAN and USER (including all types of UID and GID).
--no-headers
Print no header line at all. --no-heading is an alias for this option.
O order
Sorting order (overloaded). The BSD O option can act like -O (user-defined output format with some common fields predefined) or can be used to specify sort order. Heuristics are used to determine the behavior of this option. To ensure that the desired behavior is obtained (sorting or formatting), specify the option in some other way (e.g. with -O or --sort).
For sorting, obsolete BSD O option syntax is O[+|-]k1[,[+|-]k2[,...]]. It orders the processes listing according to the multilevel sort specified by the sequence of one-letter short keys k1,k2, ... described in the OBSOLETE SORT KEYS section below. The "+" is currently optional, merely re-iterating the default direction on a key, but may help to distinguish an O sort from an O format. The "-" reverses direction only on the key
it precedes.
--rows n
Set screen height.
S Sum up some information, such as CPU usage, from dead child processes into their parent. This is useful for examining a system where a parent process repeatedly forks off short-lived children to do work.
--sort spec
Specify sorting order. Sorting syntax is [+|-]key[,[+|-]key[,...]]. Choose a multi-letter key from the STANDARD FORMAT SPECIFIERS section. The "+" is optional since default direction is increasing numerical or lexicographic order. Identical to k. For example: ps jax --sort=uid,-ppid,+pid
w Wide output. Use this option twice for unlimited width.
-w Wide output. Use this option twice for unlimited width.
--width n
Set screen width.
THREAD DISPLAY
H Show threads as if they were processes.
-L Show threads, possibly with LWP and NLWP columns.
m Show threads after processes.
-m Show threads after processes.
-T Show threads, possibly with SPID column.
OTHER INFORMATION
--help section
Print a help message. The section argument can be one of simple, list, output, threads, misc, or all. The argument can be shortened to one of the underlined letters as in: s|l|o|t|m|a.
--info Print debugging info.
L List all format specifiers.
V Print the procps-ng version.
-V Print the procps-ng version.
--version
Print the procps-ng version.
NOTES
This ps works by reading the virtual files in /proc. This ps does not need to be setuid kmem or have any privileges to run. Do not give this ps any special permissions. この ps は、/proc 内の仮想ファイルを読み取ることで機能します。 この ps は、setuid kmem である必要も、実行する特権も必要ありません。 この ps には特別な権限を与えないでください。
CPU usage is currently expressed as the percentage of time spent running during the entire lifetime of a process. This is not ideal, and it does not conform to the standards that ps otherwise conforms to. CPU usage is unlikely to add up to exactly 100%. 現在、CPU 使用率は、プロセスの存続期間全体で実行に費やされた時間の割合として表されます。 これは理想的ではなく、ps が準拠する標準にも準拠しません。 CPU 使用率の合計が正確に 100% になることはほとんどありません。
The SIZE and RSS fields don't count some parts of a process including the page tables, kernel stack, struct thread_info, and struct task_struct. This is usually at least 20 KiB of memory that is always resident. SIZE is the virtual size of the process (code+data+stack). SIZE フィールドと RSS フィールドは、ページ テーブル、カーネル スタック、struct thread_info、struct task_struct などのプロセスの一部の部分をカウントしません。 これは通常、常に常駐する少なくとも 20 KiB のメモリです。 SIZE はプロセスの仮想サイズ (コード + データ + スタック) です。
Processes marked <defunct> are dead processes (so-called "zombies") that remain because their parent has not destroyed them properly. These processes will be destroyed by init(8) if the parent process exits. <defunct> とマークされたプロセスは、親が適切に破棄しなかったために残っている死んだプロセス (いわゆる「ゾンビ」) です。 親プロセスが存在する場合、これらのプロセスは init(8) によって破棄されます。
If the length of the username is greater than the length of the display column, the username will be truncated. See the -o and -O formatting options to customize length. ユーザー名の長さが表示列の長さより長い場合、ユーザー名は切り詰められます。 長さをカスタマイズするには、-o および -O の書式設定オプションを参照してください。
Commands options such as ps -aux are not recommended as it is a confusion of two different standards. According to the POSIX and UNIX standards, the above command asks to display all processes with a TTY (generally the commands users are running) plus all processes owned by a user named x. If that user doesn't exist, then ps will assume you really meant ps aux. ps -aux などのコマンド オプションは、2 つの異なる標準を混同するため推奨されません。 POSIX および UNIX 標準に従って、上記のコマンドは、TTY を持つすべてのプロセス (通常、ユーザーが実行しているコマンド) に加えて、x という名前のユーザーが所有するすべてのプロセスを表示するように要求します。 そのユーザーが存在しない場合、ps は、ユーザーが本当に ps aux を意味しているとみなします。
PROCESS FLAGS
The sum of these values is displayed in the "F" column, which is provided by the flags output specifier:
1 forked but didn't exec
4 used super-user privileges
これらの値の合計は、flags 出力指定子によって提供される「F」列に表示されます。
1 はフォークされましたが実行されませんでした
4 使用されたスーパーユーザー権限
PROCESS STATE CODES
Here are the different values that the s, stat and state output specifiers (header "STAT" or "S") will display to describe the state of a process
以下に、s、stat、state 出力指定子 (ヘッダー「STAT」または「S」) がプロセスの状態を説明するために表示するさまざまな値を示します。:
D uninterruptible sleep (usually IO)
I Idle kernel thread
R running or runnable (on run queue)
S interruptible sleep (waiting for an event to complete)
T stopped by job control signal
t stopped by debugger during the tracing
W paging (not valid since the 2.6.xx kernel)
X dead (should never be seen)
Z defunct ("zombie") process, terminated but not reaped by its parent
For BSD formats and when the stat keyword is used, additional characters may be displayed:
< high-priority (not nice to other users)
N low-priority (nice to other users)
L has pages locked into memory (for real-time and custom IO)
s is a session leader
l is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)
+ is in the foreground process group
OBSOLETE SORT KEYS
These keys are used by the BSD O option (when it is used for sorting). The GNU --sort option doesn't use these keys, but the specifiers described below in the STANDARD FORMAT SPECIFIERS section. Note that the values used in sorting are the internal values ps uses and not the "cooked" values used in some of the output format fields (e.g. sorting on tty will sort into device number, not according to the terminal name displayed). Pipe ps output into the sort(1) command if you want to sort the cooked values.
これらのキーは、BSD O オプション (ソートに使用される場合) によって使用されます。 GNU --sort オプションでは、これらのキーは使用されませんが、以下の「標準形式指定子」セクションで説明されている指定子が使用されます。 ソートに使用される値は ps が使用する内部値であり、一部の出力形式フィールドで使用される「クックされた」値ではないことに注意してください (たとえば、tty でソートすると、表示される端末名ではなくデバイス番号にソートされます)。 クックされた値を並べ替える場合は、ps 出力を sort(1) コマンドにパイプします。
KEY LONG DESCRIPTION
c cmd simple name of executable
C pcpu cpu utilization
f flags flags as in long format F field
g pgrp process group ID
G tpgid controlling tty process group ID
j cutime cumulative user time
J cstime cumulative system time
k utime user time
m min_flt number of minor page faults
M maj_flt number of major page faults
n cmin_flt cumulative minor page faults
N cmaj_flt cumulative major page faults
o session session ID
p pid process ID
P ppid parent process ID
r rss resident set size
R resident resident pages
s size memory size in kilobytes
S share amount of shared pages
t tty the device number of the controlling tty
T start_time time process was started
U uid user ID number
u user user name
v vsize total VM size in KiB
y priority kernel scheduling priority
AIX FORMAT DESCRIPTORS
This ps supports AIX format descriptors, which work somewhat like the formatting codes of printf(1) and printf(3). For example, the normal default output can be produced with this: ps -eo "%p %y %x %c". The NORMAL codes are described in the next section.
この ps は、printf(1) および printf(3) のフォーマット コードと似た働きをする AIX フォーマット記述子をサポートします。 たとえば、通常のデフォルト出力は、ps -eo "%p %y %x %c" で生成できます。 NORMAL コードについては次のセクションで説明します。
CODE NORMAL HEADER
%C pcpu %CPU
%G group GROUP
%P ppid PPID
%U user USER
%a args COMMAND
%c comm COMMAND
%g rgroup RGROUP
%n nice NI
%p pid PID
%r pgid PGID
%t etime ELAPSED
%u ruser RUSER
%x time TIME
%y tty TTY
%z vsz VSZ
psコマンドに関連のあるコマンド
man psコマンドを実行した際に以下のコマンドについて以下のように記載されています。
SEE ALSO
pgrep(1), pstree(1), top(1), proc(5).
pgrep
pgrepは実行中のプロセスからプロセスIDを探せるコマンドです。
実行中のプロセスの中から、プロセス名やユーザー、グループ、端末名などを表すパターンを使ってプロセスIDを探すコマンドです。パターンには拡張正規表現(第10回)を使用できます。
コマンド名からプロセスIDを探す際には、pidofコマンドを使うこともできます。
参考:https://atmarkit.itmedia.co.jp/ait/articles/1707/28/news010.html
pstree
pstreeコマンドはプロセスの親子関係をツリー表示することができるコマンドです。
詳細:https://xtech.nikkei.com/it/article/COLUMN/20071204/288730/
top
topコマンドは、実行中のプロセスをCPU使用率が高い順に表示します。
「top」は現在実行中のプロセスをCPU利用率が高い順に表示します。表示はリアルタイムで更新されていき、「q」を入力すると終了します。

proc
procコマンドは現在のプロセスの状態を表示します。
man proc をRHEL9で実行して以下の説明が得られます。
DESCRIPTION
The proc filesystem is a pseudo-filesystem which provides an interface to kernel data structures. It is commonly mounted at /proc. Typi‐cally, it is mounted automatically by the system, but it can also be mounted manually using a command such as
proc ファイルシステムは、カーネル データ構造へのインターフェイスを提供する疑似ファイルシステムです。 通常、/proc にマウントされます。 通常、システムによって自動的にマウントされますが、次のようなコマンドを使用して手動でマウントすることもできます。:
mount -t proc proc /proc
Most of the files in the proc filesystem are read-only, but some files are writable, allowing kernel variables to be changed.
proc ファイルシステム内のファイルのほとんどは読み取り専用ですが、一部のファイルは書き込み可能であり、カーネル変数を変更できます。