LoginSignup
3
3

More than 3 years have passed since last update.

プロセス確認コマンドpsのオプション忘備録

Posted at

超基本だけどプロセス確認コマンドpsのオプション忘備録。

ps

オプションなし。
自分のユーザのプロセスが省略された形で出てくる。

$ ps

  PID TTY           TIME CMD
24863 ttys000    0:00.10 /bin/bash -l
32161 ttys004    0:00.05 -bash

ps -f

fオプション。
UID、PPID、C、STIMEのカラムを追加で確認できる。

$ ps -f

  UID   PID  PPID   C STIME   TTY           TIME CMD
  501 24863 24861   0  7:32PM ttys000    0:00.10 /bin/bash -l
  501 32161 32160   0  6:45PM ttys004    0:00.05 -bash

ps -ef

$ ps -ef

  UID   PID  PPID   C STIME   TTY           TIME CMD
    0     1     0   0 木10AM ??         3:30.67 /sbin/launchd
    0   102     1   0 木10AM ??         0:07.61 /usr/sbin/syslogd
    0   103     1   0 木10AM ??         0:17.05 /usr/libexec/UserEventAgent (System)
...

全ユーザの実行中プロセスが省略されずに表示される。

カラム 意味
UID ユーザID
PID プロセス番号
PPID 親プロセスID
C プロセスのCPU使用状況
STIME プロセスの開始時刻
TTY 端末名
TIME プロセスの総実行時間
CMD 実行コマンド名

ps -ef | grep xxxx

プロセスを探したいときは基本的にこれを使う。

$ ps -ef | grep xxxx

$ ps -ef | grep httpd

    0   141     1   0 木10AM ??         0:02.34 /usr/sbin/httpd -D FOREGROUND
   70   320   141   0 木10AM ??         0:00.00 /usr/sbin/httpd -D FOREGROUND
  501 32954 32161   0  7:31PM ttys004    0:00.00 grep httpd

参考

【Linux】ps実行時に-efオプションを付ける理由 | 金融エンジニア

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3