리눅스 ps

From CS Wiki
Revision as of 03:45, 29 April 2018 by 221.153.37.97 (talk) (새 문서: == 개요 == * 리눅스&유닉스 계열 운영체제에서 프로세스 목록을 볼 수 있는 명령어 * 위치 : /bin/ps == 옵션 == <pre class='shell'> ********* simple sele...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

개요

  • 리눅스&유닉스 계열 운영체제에서 프로세스 목록을 볼 수 있는 명령어
  • 위치 : /bin/ps

옵션

********* simple selection *********  ********* selection by list *********
-A all processes                      -C by command name
-N negate selection                   -G by real group ID (supports names)
-a all w/ tty except session leaders  -U by real user ID (supports names)
-d all except session leaders         -g by session OR by effective group name
-e all processes                      -p by process ID
                                      -q by process ID (unsorted & quick)
T  all processes on this terminal     -s processes in the sessions given
a  all w/ tty, including other users  -t by tty
g  OBSOLETE -- DO NOT USE             -u by effective user ID (supports names)
r  only running processes             U  processes for specified users
x  processes w/o controlling ttys     t  by tty
*********** output format **********  *********** long options ***********
-o,o user-defined  -f full            --Group --User --pid --cols --ppid
-j,j job control   s  signal          --group --user --sid --rows --info
-O,O preloaded -o  v  virtual memory  --cumulative --format --deselect
-l,l long          u  user-oriented   --sort --tty --forest --version
-F   extra full    X  registers       --heading --no-heading --context
                                      --quick-pid
                    ********* misc options *********
-V,V  show version      L  list format codes  f  ASCII art forest
-m,m,-L,-T,H  threads   S  children in sum    -y change -l format
-M,Z  security data     c  true command name  -c scheduling class
-w,w  wide output       n  numeric WCHAN,UID  -H process hierarchy

활용

  • 어떤 프로세스가 실행되고 있는지 확인할 때 흔히 아래와 같이 쓰인다
# ps -ef | grep [프로세스명]

실행결과 예시

# ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 Jan02 ?        00:00:07 /sbin/init
root         2     0  0 Jan02 ?        00:00:00 [kthreadd]
root         3     2  0 Jan02 ?        00:00:04 [migration/0]
root         4     2  0 Jan02 ?        00:00:07 [ksoftirqd/0]
root         5     2  0 Jan02 ?        00:00:00 [stopper/0]
root         6     2  0 Jan02 ?        00:00:13 [watchdog/0]
root         7     2  0 Jan02 ?        00:00:04 [migration/1]
root         8     2  0 Jan02 ?        00:00:00 [stopper/1]
root         9     2  0 Jan02 ?        00:00:07 [ksoftirqd/1]
root        10     2  0 Jan02 ?        00:00:11 [watchdog/1]
root        11     2  0 Jan02 ?        01:28:32 [events/0]
root        12     2  0 Jan02 ?        01:07:32 [events/1]
root        13     2  0 Jan02 ?        00:00:00 [events/0]
root        14     2  0 Jan02 ?        00:00:00 [events/1]
root        15     2  0 Jan02 ?        00:00:00 [events_long/0]
root        16     2  0 Jan02 ?        00:00:00 [events_long/1]
root        17     2  0 Jan02 ?        00:00:00 [events_power_ef]
root        18     2  0 Jan02 ?        00:00:00 [events_power_ef]
root        19     2  0 Jan02 ?        00:00:00 [cgroup]
... (이하 생략) ...