procfiles 명령어 (AIX 5.3·6.1)

핵심 정리

  • 프로세스가 연 모든 파일 기술자의 정보(종류, 모드, 장치, i-node, 소유자, 열기 모드)를 보여 줍니다.
  • -n을 주면 파일 기술자가 가리키는 파일의 이름도 보여 줍니다.
  • -c(6.1)는 열 형식 표로, -F는 다른 프로세스가 대상 프로세스를 제어하고 있어도 강제로 제어를 가져옵니다.
  • 처음 줄에 현재 파일 기술자 한도(Current rlimit)가 나옵니다.
  • 일반 파일은 연 모드에 따른 권한을, 일반 파일이 아닌 것은 접근 모드 0을 보여 줍니다.
  • AIX에서 lsof 대신 프로세스가 연 파일을 볼 때 씁니다.
항목 내용
버전 AIX 5.3, AIX 6.1 (6.1에서 -c 플래그가 더해짐)
원문 IBM Commands Reference — 5.3 Volume 4, 6.1 Volume 4
파일 /proc(proc 파일 시스템), /usr/bin/procfiles
관련 명령어 proctree, procmap, procldd, procwdx, lsof(별도 설치)

목적

프로세스가 연 모든 파일 기술자의 정보를 보고합니다.

영어 원문

Reports information about all file descriptors opened by processes.

구문

text
procfiles [ -F ] [ -n ] [ -c ] ProcessID ...

-c는 6.1 구문에만 있습니다.

설명

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

  • 대부분의 proctools 명령은 프로세스 ID나 /proc/ProcessID 문자열 목록을 받으므로, 셸 확장 /proc/*로 모든 프로세스를 지정할 수 있습니다.
  • /proc에서 모은 정보는 프로세스의 현재 상태를 찍은 것이라 멈춘 프로세스가 아니면 언제든 바뀔 수 있습니다.

일반 파일은 연 모드에 따른 권한을 보여 주고, 일반 파일이 아닌 것은 접근 모드 0입니다.

procfiles 명령은 프로세스가 연 모든 파일 기술자의 정보를 보고합니다. -n 옵션을 주면 해당 파일의 이름도 보여 줍니다.

영어 원문

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 ASCIIi 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.

Regular files have permission based on mode it was opened with. Any non-regular files have 0 access mode.

The procfiles command reports information on all file descriptors opened by processes. With the -n option it also displays the names of the corresponding files.

플래그

플래그 설명
-c 열 형식으로 출력합니다. 6.1부터
-F 다른 프로세스가 대상 프로세스를 제어하고 있어도 procfiles가 강제로 제어를 가져옵니다.
-n 파일 기술자가 가리키는 파일의 이름을 출력합니다.
ProcessID 프로세스 ID를 지정합니다.
영어 원문
  • -c — Prints the output in column format.
  • -F — Forces procfiles to take control of the target process even if another process has control.
  • -n — Prints the names of the files referred to by file descriptors.
  • ProcessID — Specifies the process id.

예제

  1. 프로세스 11928이 연 파일 기술자의 상태와 제어 정보를 보여 줍니다.
bash
procfiles 11928
text
11928 : -sh
  Current rlimit: 2000 file descriptors
   0: S_IFCHR mode:0622 dev:10,4 ino:2584 uid:100 gid:100 rdev:28,1
      O_RDONLY
   1: S_IFCHR mode:0622 dev:10,4 ino:2584 uid:100 gid:100 rdev:28,1
      O_RDONLY
   2: S_IFCHR mode:0622 dev:10,4 ino:2584 uid:100 gid:100 rdev:28,1
      O_RDONLY
  63: S_IFREG mode:0600 dev:10,8 ino:311 uid:100 gid:100 rdev:40960,10317
      O_RDONLY size:2574
  1. 프로세스 15502가 연 파일 기술자의 이름, 상태, 제어 정보를 보여 줍니다. 마지막 기술자에 name:/tmp/foo가 붙습니다.
bash
procfiles -n 15502
text
15502 : /home/guest/test
  Current rlimit: 2000 file descriptors
   0: S_IFCHR mode:0622 dev:10,4 ino:2584 uid:100 gid:100 rdev:28,1
      O_RDONLY
   3: S_IFREG mode:0644 dev:10,7 ino:26 uid:100 gid:100 rdev:0,0
      O_RDONLY size:0 name:/tmp/foo
  1. 프로세스 278684의 파일 기술자를 열 형식으로 보여 줍니다(6.1).
bash
procfiles -c 278684
text
278684 : -ksh
 Current rlimit: 2000 file descriptors
--------------------------------------------------------------------------------
FD  TYPE  MODE       DEV/RDEV      UID   GID     OPMOD    INODE
--------------------------------------------------------------------------------
0   c     ---------  10, 4(19, 0)  root  system  R-W      16385
1   c     ---------  10, 4(19, 0)  root  system  R-W      16385
2   c     ---------  10, 4(19, 0)  root  system  R-W      16385
61  -     rw-r--r--  10, 7         root  system  R-W      32
63  -     rw-------  10, 4         root  system  R-W | A  1051
영어 원문
  1. To display status and control information on the file descriptors opened by process 11928, enter the following command: procfiles 11928

The output of this command might look like this: 11928 : -sh

Current rlimit: 2000 file descriptors
0: S_IFCHR mode:0622 dev:10,4 ino:2584 uid:100 gid:100 rdev:28,1
   O_RDONLY
1: S_IFCHR mode:0622 dev:10,4 ino:2584 uid:100 gid:100 rdev:28,1
   O_RDONLY
2: S_IFCHR mode:0622 dev:10,4 ino:2584 uid:100 gid:100 rdev:28,1
   O_RDONLY
63: S_IFREG mode:0600 dev:10,8 ino:311 uid:100 gid:100 rdev:40960,10317
   O_RDONLY size:2574
  1. To display name, status and control information on the file descriptors opened by process 15502, enter the following command: procfiles -n 15502

The output of this command might look like this: 15502 : /home/guest/test

Current rlimit: 2000 file descriptors
0: S_IFCHR mode:0622 dev:10,4 ino:2584 uid:100 gid:100 rdev:28,1
   O_RDONLY
1: S_IFCHR mode:0622 dev:10,4 ino:2584 uid:100 gid:100 rdev:28,1
  O_RDONLY
2: S_IFCHR mode:0622 dev:10,4 ino:2584 uid:100 gid:100 rdev:28,1
  O_RDONLY
3: S_IFREG mode:0644 dev:10,7 ino:26 uid:100 gid:100 rdev:0,0
  O_RDONLY size:0 name:/tmp/foo
  1. To display status and control information on the file descriptors opened by the 278684 process, enter the following command:
procfiles -c 278684

The output of this command might look like this:

278684 : -ksh
 Current rlimit: 2000 file descriptors
--------------------------------------------------------------------------------
FD TYPE MODE DEV/RDEV UID GID OPMOD INODE
--------------------------------------------------------------------------------
0 c --------- 10, 4(19, 0) root system R-W 16385
1 c --------- 10, 4(19, 0) root system R-W 16385
2 c --------- 10, 4(19, 0) root system R-W 16385
61 - rw-r--r-- 10, 7 root system R-W 32
63 - rw------- 10, 4 root system R-W | A 1051

파일

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

관련 명령어: proccred, procflags, procldd, procmap, procwdx

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

Related reference:

  • proccred Command
  • “procflags Command”
  • procldd Command
  • procmap Command
  • procwdx Command

리눅스(GNU)와 다른 점

리눅스에서는 ls -l /proc/PID/fd나 lsof -p PID로 같은 정보를 봅니다. AIX에는 lsof가 기본으로 없어 procfiles -n PID를 씁니다. 특정 파일을 연 프로세스를 거꾸로 찾을 때는 AIX에서 fuser를 씁니다.