proctree 명령어 (AIX 5.3·6.1)

핵심 정리

  • 지정한 프로세스(또는 사용자)를 포함한 프로세스 트리를 출력합니다. 자식은 부모 아래에 들여 씁니다.
  • 숫자로만 된 인수는 PID, 아니면 로그인 이름으로 봅니다. 아무것도 주지 않으면 모든 프로세스를(프로세스 0의 자식은 빼고) 보여 줍니다.
  • -a는 프로세스 0의 자식도 넣습니다.
  • 6.1: -T(\-- 선으로 꾸민 트리), -t(스레드 ID와 pthread ID), -p PID·-u 사용자, -@ [WPAR](WPAR 이름 표시).
  • /proc에서 읽은 순간의 정보라 멈춘 프로세스가 아니면 언제든 바뀔 수 있습니다. 정보를 읽을 수 없는 프로세스(좀비 등)는 PID만 보여 줍니다.
  • proctools(proc* 명령) 가운데 하나입니다.
항목 내용
버전 AIX 5.3, AIX 6.1 (5.3은 -a와 PID·사용자만, 6.1에서 -T, -t, -p, -u, -@가 더해짐)
원문 IBM Commands Reference — 5.3 Volume 4, 6.1 Volume 4
파일 /proc(proc 파일 시스템), /usr/bin/proctree
관련 명령어 procfiles, proccred, procsig, procstop, procwdx, ps -T

목적

프로세스 트리를 출력합니다.

영어 원문

Prints the process tree containing the specified process IDs or users.

구문

text
proctree [ -a ] [ { ProcessID | User } ]
proctree [ -a ] [ -T ] [ -t ] [ { -p ProcessID | -u User } ] [ -@ [ WparName ] ]

둘째 구문은 6.1에만 있습니다.

설명

/proc 파일 시스템은 프로세스를 제어하는 방법을 주며, 프로세스와 스레드의 현재 상태 정보를 이진 형식으로 제공합니다. proctools 명령은 그 정보 일부로 ASCII 보고서를 만듭니다.

  • 대부분의 proctools 명령은 프로세스 ID나 /proc/ProcessID 문자열 목록을 받습니다. 그래서 셸 확장 /proc/*로 시스템의 모든 프로세스를 지정할 수 있습니다.
  • 각 명령은 지정한 프로세스의 정보를 /proc에서 모아 보여 줍니다. procrun과 procstop은 /proc 인터페이스로 프로세스를 시작하고 멈춥니다.
  • /proc에서 모은 정보는 프로세스의 현재 상태를 찍은 것이라 멈춘 프로세스가 아니면 언제든 바뀔 수 있습니다.

proctree 명령은 지정한 프로세스 ID나 사용자를 포함한 프로세스 트리를 출력합니다. 자식 프로세스는 각 부모 아래에 들여 씁니다. 숫자로만 된 인수는 프로세스 ID로, 아니면 사용자 로그인 이름으로 봅니다. 기본으로 프로세스 0의 자식을 뺀 모든 프로세스를 보고합니다.

  • (6.1) -@를 매개변수 없이 주면 모든 WPAR 이름을 보여 주고, WparName을 주면 그 WPAR 이름만 보여 줍니다.
  • (6.1) 스레드 ID와 딸린 pthread ID를 보려면 -t를 씁니다. 커널 프로세스는 스레드 ID만 보여 줍니다.

참고(6.1): 프로세스 정보를 얻을 수 없으면 프로세스 ID만 보여 주고 나머지는 비워 둡니다. 예를 들어 좀비 프로세스는 프로세스 ID만 보여 줍니다.

영어 원문

The /proc filesystem provides a mechanism to control processes. It also gives access to information about the current state of processes and threads, but in binary form. The proctools commands provide ASCII reports based on some of the available information.

Most of the commands take a list of process IDs or /proc/ProcessID strings as input. The shell expansion /proc/* can therefore be used to specify all processes in the system.

Each of the proctools commands gathers information from /proc for the specified processes and displays it to the user. The proctools commands like procrun and procstop start and stop a process using the /proc interface.

The information gathered by the commands from /proc is a snapshot of the current state of processes, and therefore can vary at any instant except for stopped processes.

The proctree command prints the process tree containing the specified process IDs or users. The child processes are indented from their respective parent processes. An argument of all digits is taken to be a process ID, otherwise it is assumed to be a user login name. The default action is to report on all processes, except children of process 0.

When you specify the -@ flag with no parameters, all WPAR names are displayed. If you specify the WparName parameter, only those WPAR names are displayed.

For displaying thread IDs and associated pthread IDs, specify the -t option. For a kernel process, the proctree command displays only the thread ID.

Note: If the information about the process cannot be retrieved, the proctree command displays only the process ID. The other information about the process is shown as blank. For example, the proctree command shows only the process ID for the zombie process.

플래그

플래그 설명
-a 프로세스 0의 자식도 보여 줍니다. 기본은 뺍니다.
ProcessID 프로세스 ID를 지정합니다.
-p ProcessID 프로세스 ID를 지정합니다. 6.1부터
-T 프로세스 트리를 꾸민 형식으로 출력합니다. 6.1부터
-t 프로세스의 스레드 ID와 딸린 pthread ID를 보여 줍니다. 6.1부터
User 사용자 이름을 지정합니다.
-u User 사용자 이름을 지정합니다. 6.1부터
-@ 모든 WPAR 이름을 보여 줍니다. WPAR 안에서는 쓸 수 없습니다. 6.1부터
-@ WparName 지정한 WPAR의 프로세스만 보여 줍니다. WPAR 안에서는 쓸 수 없습니다. 6.1부터
영어 원문
  • -a — Includes children of process 0 in the display. The default is to exclude them.
  • ProcessID — Specifies the process ID.
  • -p ProcessID — Specifies the process ID.
  • -T — Displays the formatted output of the process tree.
  • -t — Displays thread IDs and associated pthread IDs for the process.
  • User — Specifies the user name.
  • -u User — Specifies the user name.
  • -@ — Displays all WPAR names. Note: The -@ flag is not supported when executed within a workload partition.
  • -@ WparName — Displays only the processes of the WPAR you specify using the WparName parameter. Note: The -@ flag is not supported when executed within a workload partition.

예제

  1. 프로세스 12312의 조상과 모든 자식을 보여 줍니다.
bash
proctree 12312
text
4954 /usr/sbin/srcmstr
  7224 /usr/sbin/inetd
     5958 telnetd -a
        13212 -sh
          14718 ./proctree 13212
  1. 프로세스 0의 자식까지 넣어 12312의 조상과 자식을 보여 줍니다. 맨 위에 1 /etc/init이 더해집니다.
bash
proctree -a 12312
text
1 /etc/init
  4954 /usr/sbin/srcmstr
    7224 /usr/sbin/inetd
       5958 telnetd -a
          13212 -sh
            14724 ./proctree -a 13212
  1. WPAR corral2의 프로세스 트리를 보여 줍니다(6.1). 줄마다 앞에 WPAR 이름이 붙습니다(출력 일부).
bash
proctree -@ corral2
text
corral2 401496 /etc/init
corral2 319680 /usr/sbin/srcmstr
corral2 102636 /usr/sbin/inetd
corral2 311454 /usr/sbin/cron
  1. 프로세스마다 WPAR 이름을 보여 줍니다(6.1). 전역 환경의 프로세스는 Global입니다.
bash
proctree -@
  1. 프로세스 102636의 조상과 자식을 WPAR 이름과 함께 보여 줍니다(6.1).
bash
proctree -p 102636 -@
text
Global 168084 /usr/sbin/srcmstr
corral2 401496 /etc/init
corral2 319680 /usr/sbin/srcmstr
corral2 102636 /usr/sbin/inetd
  1. 프로세스 213246의 트리를 꾸민 형식으로 보여 줍니다(6.1).
bash
proctree -T -p 213246
text
192652 \--/usr/sbin/srcmstr
200830    \--/usr/sbin/inetd
213246       \--telnetd -a
229592          \---ksh
  1. 프로세스 344172의 스레드 ID와 pthread ID를 보여 줍니다(6.1).
bash
proctree -t -p 344172
text
192652 /usr/sbin/srcmstr
    TID : 225535 (pTID : 1)
  200830 /usr/sbin/inetd
       TID : 360677 (pTID : 1)
          344172 appthd
               TID : 1065119 (pTID : 1)
               TID : 1028171 (pTID : 258)
  1. 꾸민 트리와 스레드 ID를 함께 보여 줍니다(6.1).
bash
proctree -tT -p 344172
영어 원문
  1. To display the ancestors and all the children of the 12312 process, enter the following command:
proctree 12312

The output of this command might look like this:

4954 /usr/sbin/srcmstr
  7224 /usr/sbin/inetd
     5958 telnetd -a
        13212 -sh
          14718 ./proctree 13212
  1. To display the ancestors and children of the 12312 process, including children of process 0, enter the following command: proctree -a 12312

The output of this command might look like this: 1 /etc/init

4954 /usr/sbin/srcmstr
  7224 /usr/sbin/inetd
     5958 telnetd -a
        13212 -sh
          14724 ./proctree -a 13212
  1. To display the process tree of WPAR corral2, enter the following command: proctree -@ corral2

The output of this command might look like this: corral2 401496 /etc/init corral2 319680 /usr/sbin/srcmstr corral2 102636 /usr/sbin/inetd corral2 249954 /opt/rsct/bin/rmcd -a IBM.LPCommands -r corral2 254132 /opt/rsct/bin/IBM.AuditRMd corral2 295098 /opt/rsct/bin/IBM.ServiceRMd corral2 303218 /usr/dt/bin/dtlogin corral2 307370 /usr/sbin/writesrv corral2 323836 /usr/sbin/qdaemon corral2 331970 /usr/sbin/muxatmd corral2 348210 /usr/sbin/syslogd corral2 352472 sendmail: accepting connections H nnections corral2 364564 /opt/rsct/bin/IBM.ERrmd corral2 405522 /usr/sbin/portmap corral2 282800 /usr/bin/xmwlm -L corral2 311454 /usr/sbin/cron corral2 376920 /usr/lib/errdemon

  1. To display the WPAR name of the processes, enter the following command: proctree -@

The output of this command might look like this: Global 114788 /usr/dt/bin/dtlogin -daemon Global 86108 dtlogin <:0> -daemon Global 123022 dtgreet 8 :0 Global 77944 /usr/lib/errdemon Global 94314 /usr/sbin/syncd 60 Global 168084 /usr/sbin/srcmstr Global 110688 /opt/rsct/bin/IBM.ServiceRMd corral2 401496 /etc/init corral2 319680 /usr/sbin/srcmstr corral2 102636 /usr/sbin/inetd corral2 249954 /opt/rsct/bin/rmcd -a IBM.LPCommands -r corral2 254132 /opt/rsct/bin/IBM.AuditRMd corral2 331970 /usr/sbin/muxatmd corral2 348210 /usr/sbin/syslogd corral2 364564 /opt/rsct/bin/IBM.ERrmd corral2 405522 /usr/sbin/portmap corral2 282800 /usr/bin/xmwlm -L corral2 311454 /usr/sbin/cron corral2 376920 /usr/lib/errdemon Global 151626 /usr/ccs/bin/shlap64 Global 274578 /usr/sbin/getty /dev/console ...

  1. To display the ancestors, all of the children, and the WPAR name of the 102636 process, enter the following command: proctree -p 102636 -@

The output of this command might look like this:

Global 168084 /usr/sbin/srcmstr
corral2 401496 /etc/init
corral2 319680 /usr/sbin/srcmstr
corral2 102636 /usr/sbin/inetd
  1. To display the formatted process-tree output of the 213246 process, enter the following command:
proctree -T -p 213246

The output of this command might look like this:

192652 \--/usr/sbin/srcmstr
200830 \--/usr/sbin/inetd
213246 \--telnetd -a
229592 \---ksh
  1. To display thread IDs and associated pthread IDs for the 344172 process, enter the following command:
proctree -t -p 344172

The output of this command might look like this:

192652 /usr/sbin/srcmstr
    TID : 225535 (pTID : 1)
  200830 /usr/sbin/inetd
       TID : 360677 (pTID : 1)
     323642 telnetd -a
         TID : 770057 (pTID : 1)
        307428 -ksh
            TID : 1056861 (pTID : 1)
          344172 appthd
               TID : 1065119 (pTID : 1)
               TID : 1028171 (pTID : 258)
               TID : 1011789 (pTID : 2057)
               TID : 1024105 (pTID : 1800)
  1. To display the formatted process-tree output for the 344172 process along with thread IDs and associated pthread IDs, enter the following command:
proctree -tT -p 344172

The output of this command might look like this:

192652 \--/usr/sbin/srcmstr
           ~~TID : 225535 (pTID : 1)
200830 \--/usr/sbin/inetd
               ~~TID : 360677 (pTID : 1)
323642 \--telnetd -a
                   ~~TID : 770057 (pTID : 1)
307428 \---ksh
                      ~~TID : 1056861 (pTID : 1)
344172 \--appthd
                             |~~TID : 1065119 (pTID : 1)
                             |~~TID : 1028171 (pTID : 258)
                             |~~TID : 1011789 (pTID : 2057)
                              ~~TID : 1024105 (pTID : 1800)

파일

파일 설명
/proc proc 파일 시스템입니다.

관련 명령어: proccred, procfiles, procsig, procstop, procwdx

영어 원문
  • /proc — Contains the /proc filesystem.

Related reference:

  • proccred Command
  • procfiles Command
  • procsig Command
  • procstop Command
  • procwdx Command

리눅스(GNU)와 다른 점

리눅스에서는 pstree(psmisc)가 같은 일을 합니다. pstree -p는 PID를, pstree 사용자는 그 사용자의 트리를 보여 줍니다. AIX에는 pstree가 기본으로 없으므로 proctree나 ps -T PID를 씁니다.