pax 명령어 (AIX 5.3·6.1)

핵심 정리

  • POSIX 표준 아카이브 도구로, tar(ustar)·cpio·pax 형식을 모두 읽고 씁니다. -r과 -w로 모드를 고릅니다: 없음(목록), -r(읽기·풀기), -w(쓰기), -rw(디렉터리 복사).
  • 자주 쓰는 형태: pax -wvf /tmp/a.pax dir(만들기), pax -vf /tmp/a.pax(목록), pax -rvf /tmp/a.pax(풀기), pax -rw olddir newdir(복사).
  • 기본 형식은 ustar이며 -x pax(확장 헤더, 큰 파일·긴 이름·큰 ID), -x cpio를 고를 수 있습니다. AIX에서 8GB를 넘는 파일을 보관할 때 -x pax를 많이 씁니다.
  • -s /old/new/로 보관·풀기 때 경로 이름을 바꾸고, -p e로 소유자·모드·시각·ACL을 보존하고, -k로 기존 파일을 덮어쓰지 않습니다.
  • -U는 ACL과 확장 속성, -Z(6.1)는 EFS 정보를 보관합니다.
항목 내용
버전 AIX 5.3, AIX 6.1 (6.1에서 -Z(EFS 정보 보관)가 더해짐)
원문 IBM Commands Reference — 5.3 Volume 4, 6.1 Volume 4
파일 /usr/bin/pax
관련 명령어 tar, cpio, rmt, dd

목적

아카이브 파일의 구성 파일을 꺼내고, 쓰고, 나열합니다. 파일과 디렉터리 계층도 복사합니다.

영어 원문

Extracts, writes, and lists members of archive files; copies files and directory hierarchies.

구문

목록:

text
pax [ -c | -n ] [ -d ] [ -U ] [ -v ] [ -H | -L ] [ -f Archive ] [ -s ReplacementString... ] [ -x Format ]
    [ -o Options ] [ -Z ] [ Pattern... ]

읽기(-r):

text
pax -r [ -c | -n ] [ -d ] [ -i ] [ -k ] [ -U ] [ -u ] [ -v ] [ -H | -L ] [ -f Archive ] [ -o Options ]
       [ -p String... ] [ -s ReplacementString... ] [ -x Format ] [ -Z ] [ Pattern ... ]

쓰기(-w):

text
pax -w [ -d ] [ -i ] [ -t ] [ -U ] [ -u ] [ -v ] [ -X ] [ -H | -L ] [ -E ] [ -b Blocking ] [ [ -a ] -f Archive ]
       [ -o Options ] [ -s ReplacementString... ] [ -x Format ] [ -Z ] [ File... ]

복사(-r -w):

text
pax -r -w [ -d ] [ -i ] [ -k ] [ -l ] [ -t ] [ -U ] [ -u ] [ -v ] [ -X ] [ -H | -L ] [ -p String... ]
          [ -o Options ] [ -s ReplacementString... ] [ -x Format ] [ -Z ] [ File ... ] Directory

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

설명

pax 명령은 아카이브 파일의 구성 파일을 꺼내고 쓰며, 구성 파일 목록을 쓰고, 디렉터리 계층을 복사합니다. 동작은 -r과 -w로 정합니다.

참고: pax는 되살리는 파일을 적극적으로 희소(sparse) 파일로 만듭니다. 블록에 맞춰 정렬된 NULL 영역에는 물리 공간을 할당하지 않으므로, 바이트 크기는 같지만 실제 차지하는 공간은 NULL이 아닌 영역만큼입니다.

목록 모드

-r도 -w도 없으면 표준 입력에서 읽은 아카이브의 모든 구성 파일을 나열합니다. Pattern을 주면 그 패턴과 맞는 경로의 구성 파일만 표준 출력에 씁니다. 이름이 디렉터리면 그 안의 계층도 씁니다. -c, -d, -f, -n, -s, -v와 Pattern을 쓸 수 있습니다.

읽기 모드(-r)

-r만 주면 표준 입력에서 읽은 아카이브의 구성 파일을 모두 꺼냅니다. Pattern을 주면 맞는 것만 꺼내며, 디렉터리면 그 안의 계층도 꺼냅니다. -c, -d, -f, -i, -k, -n, -s, -u, -v와 Pattern을 쓸 수 있습니다.

꺼낸 파일의 접근·수정 시각은 보관한 파일과 같습니다. 모드는 보관할 때와 같되 사용자의 기본 파일 생성 모드(umask)의 영향을 받으며, S_ISUID·S_ISGID 비트는 지워집니다. 중간 디렉터리가 필요하면 S_IRWXU, S_IRWXG, S_IRWXO를 OR한 권한으로 만듭니다. 형식이 링크를 지원하는데 꺼낼 때 링크할 수 없으면 오류입니다.

쓰기 모드(-w)

-w만 주면 File의 내용을 아카이브 형식으로 표준 출력에 씁니다. File이 없으면 표준 입력에서 한 줄에 하나씩 파일 목록을 읽습니다. 디렉터리면 그 안의 파일을 모두 씁니다. -a, -b, -d, -f, -i, -o, -s, -t, -u, -v, -x, -X와 File을 쓸 수 있습니다.

복사 모드(-r -w)

둘 다 주면 File을 Directory로 복사합니다. 파일이 없으면 표준 입력에서 목록을 읽고, 디렉터리면 그 계층도 복사합니다. -d, -i, -k, -l, -o, -p, -s, -t, -u, -v, -X와 File을 쓸 수 있으며 Directory는 꼭 줘야 합니다. 복사한 파일은 아카이브에 썼다가 꺼낸 것과 같지만, 원본과 복사본 사이에 하드 링크가 생길 수 있습니다.

-o로 아카이브 알고리즘 바꾸기

-o로 키워드-값 쌍에 따라 아카이브 알고리즘을 바꿉니다. 키워드-값 쌍은 올바른 아카이브 형식을 따라야 하며, 키워드 목록은 아래 -o 설명에 있습니다.

그 밖의 참고

  • 읽기·복사 모드에서 중간 디렉터리가 필요하면, 그 디렉터리를 경로로, S_IRWXU를 모드로 해서 mkdir()과 비슷하게 만듭니다.
  • 패턴이나 파일 피연산자가 하나도 맞지 않으면 맞지 않은 것마다 표준 오류에 진단 메시지를 쓰고 오류 상태로 끝납니다.
  • 디렉터리를 순회하다 마지막 파일의 조상인, 이미 방문한 디렉터리에 들어가면 무한 루프로 보고 진단 메시지를 쓴 뒤 끝냅니다.
  • 읽기·목록 모드에서 -x pax 형식의 확장 헤더 필드(파일 이름, 링크 이름, 소유자 이름 등)를 UTF8에서 현재 코드 세트로 바꿀 수 없으면 진단 메시지를 쓰고 -o invalid=에 따라 처리한 뒤 다음 파일로 넘어갑니다.
  • AIX 5.3부터 pax는 기본으로 확장 속성을 무시합니다. -U를 주면 ACL을 포함한 확장 속성을 보관하고 되살리며, -pe는 ACL을 보존합니다. -pe로 ACL 보존에 실패하면 진단 메시지를 쓰고 0이 아닌 종료 코드를 돌려주지만 꺼낸 파일은 지우지 않습니다.
영어 원문

The pax command extracts and writes member files of archive files; writes lists of the member files of archives; and copies directory hierarchies. The -r and -w flags specify the type of archive operation.

Note: pax actively sparse files that are being restored. If a file blocks an aligned and sized areas that are NULL populated, pax does not cause physical space for those file system blocks to be allocated. The file size in bytes remains the same, but the actual space that is taken within the file system is for the non-NULL areas.

Listing Member Files of Archived Files (List Mode)

When the -r flag or the -w flag is not specified, the pax command lists all the member files of the archive file that is read from standard input. If the Pattern parameter is specified, only the member files with path names that match the specified patterns are written to standard output. If a named file is a directory, the file hierarchy that is contained in the directory is also written. When the -r flag or the -w flag is not specified, the -c, -d, -f, -n, -s, and -v flags, and the Pattern parameter can be specified.

Extracting Archive Files Using the -r Flag (Read Mode)

When the -r flag is specified, but the -w flag is not, the pax command extracts all the member files of the archive files that are read from standard input. If the Pattern parameter is specified, only the member files with path names that match the specified patterns are written to standard output. If a named file is a directory, the file hierarchy that is contained in the directory is also extracted. The -r flag can be specified with the -c, -d, -f, -i, -k, -n, -s, -u, and -v flags, and with the Pattern parameter.

The access and modification times of the extracted files are the same as the archived files. The file modes of the extracted files are the same as when they were archived, unless they are affected by the user's default file creation mode (umask). The S_ISUID and S_ISGID bits of the extracted files are cleared.

If intermediate directories are necessary to extract an archive member, the pax command creates the directories with access permissions set as the bitwise inclusive OR of the values of the S_IRWXU, S_IRWXG, and S_IRWXO masks.

If the selected archive format supports the specification of linked files, it is an error if these files cannot be linked when the archive is extracted.

Writing Archive Files Using the -w Flag (Write Mode)

When the -w flag is specified and the -r flag is not, the pax command writes the contents of the files that are specified by the File parameter to standard output in an archive format. If no File parameter is specified, a list of files to copy, one per line, is read from the standard input. When the File parameter specifies a directory, all of the files that are contained in the directory are written. The -w flag can be specified with the -a, -b, -d, -f, -i, -o, -s, -t, -u, -v, -x, and -X flags and with File parameters.

Copying Files Using the -r and -w Flags (Copy Mode)

When both the -r and -w flags are specified, the pax command copies the files that are specified by the File parameters to the destination directory specified by the Directory parameter. If no files are specified, a list of files to copy, one per line, is read from the standard input. If a specified file is a directory, the file hierarchy that is contained in the directory is also copied. The -r and -w flags can be specified with the -d, -i, -k, -l, -o, -p, -s, -t, -u, -v, and -X flags and with File parameters. The Directory parameter must be specified.

Copied files are the same as written to an archive file and are later extracted, except that there are hard links between the original and the copied files.

Modifying the Archive Algorithm Using the -o Flag

Use the -o flag to modify the archive algorithm according to keyword-value pairs. The keyword-value pairs must adhere to a correct archive format. A list of valid keywords and their behavior is given in the subsequent description of the -o flag.

Further Notes

In read or copy modes, if intermediate directories are necessary to extract an archive member, the pax command does actions similar to the mkdir() subroutine with the intermediate directory used as the path argument and the value S_IRWXU as the mode argument.

If any specified pattern or file operands are not matched by at least one file or archive member, pax writes a diagnostic message to standard error for each one that did not match and exits with an error status.

In traversing directories, the pax command detects the infinite loops by entering a previously visited directory that is an ancestor of the last file visited. Upon detection of an infinite loop, the pax command writes a diagnostic message to standard error and terminates.

When pax command is in read mode or list mode, by using the -x pax archive format, a file name, link name, owner name, or any other field in an extended header record cannot be translated from the pax UTF8 code set format to the current code set and locale. The pax command writes a diagnostic message to standard error, processes the file as described for the -o invalid= option, and then processes the next file in the archive.

For AIX 5.3, the pax command ignores the extended attributes by default. The -U option informs pax to archive or restore extended attributes, which include ACLs. The -pe option preserves ACLs. When the -pe option is specified and if pax fails to preserve the ACLs, a diagnostic message is written to the standard error but the extracted file is not deleted. A non-zero exit code is returned. A new record type is required for extended attribute entries in the pax archive files.

변수

변수 설명
Directory 파일을 복사할 대상 디렉터리 경로.
File 복사하거나 보관할 파일 경로. 맞는 파일이 없으면 오류를 알리고 끝냅니다.
Pattern 아카이브 구성원의 경로와 맞출 패턴. \는 Pattern에서 다음 문자의 특수한 뜻을 없앱니다. 없으면 모든 구성원을 고르며, 주었는데 맞는 구성원이 없으면 오류를 알리고 끝냅니다.
영어 원문
  • Directory — Specifies the path of a destination directory when copying files.
  • File — Specifies the path of a file to be copied or archived. If no file matches the File parameter, the pax command detects the error, exits, and writes a diagnostic message.
  • Pattern — Specifies a pattern that matches one or more paths of archive members. A / (backslash) character is not recognized in the Pattern parameter and it prevents the subsequent character from having any special meaning. If no Pattern parameter is specified, all members are selected in the archive. If a Pattern parameter is specified, but no archive members are found that match the pattern that is specified, the pax command detects the error, exits, and writes a diagnostic message.

플래그

플래그 설명
-a 아카이브 끝에 파일을 덧붙입니다. 스트리밍 테이프는 덧붙일 수 없습니다.
-b Blocking 출력 블록 크기(바이트). POSIX2를 따르는 응용 프로그램은 32256보다 크게 주지 않습니다. 입력에서는 자동으로 정하고, 만들 때 기본값은 형식마다 다릅니다(-x 참고). 값은 정수b(× 512), 정수k(× 1024), 정수m(× 1024 × 1024), 정수+정수(합)로도 줄 수 있습니다.
-c Pattern으로 지정한 것을 뺀 모든 파일·구성원과 맞습니다.
-d 복사·보관·꺼낼 디렉터리가 그 내용이 아니라 디렉터리 자체와 맞게 합니다.
-E 새 아카이브나 기존 아카이브에 파일을 더할 때 긴 사용자·그룹 이름을 자르지 않습니다.
-f Archive 표준 입력(-w가 없을 때)이나 표준 출력(-w만 있을 때) 대신 쓸 아카이브 파일 경로. -a와 함께면 아카이브 끝에 덧붙입니다.
-H 명령줄에 준 심볼릭 링크가 디렉터리를 가리키면 링크 이름으로 그 디렉터리 계층을 보관합니다. 기본은 링크 자체를 보관합니다.
-i 파일이나 구성원 이름을 대화형으로 바꿉니다. 이름을 보여 주고 한 줄을 읽어, 빈 줄이면 건너뛰고, 마침표 하나면 그대로, 아니면 그 줄로 이름을 바꿉니다.
-k 기존 파일을 덮어쓰지 않습니다.
-l 복사할 때 되도록 원본과 대상 사이에 하드 링크를 만듭니다.
-L 명령줄에 준 것이나 순회 중에 만난 심볼릭 링크가 디렉터리를 가리키면 링크 이름으로 그 계층을 보관합니다. 기본은 링크 자체를 보관합니다.
-n Pattern마다 맞는 첫 구성원만 고릅니다.
-o Options Options의 키워드-값 쌍으로 아카이브 알고리즘을 바꿉니다(아래 표). 형식은 keyword:=value,keyword:=value,...이며, 형식에 맞지 않는 키워드는 무시합니다. 키워드 앞에 공백을 둘 수 있고, 값 안의 쉼표는 \로 이스케이프하며, 끝의 쉼표는 무시합니다. -o를 여러 번 줄 수 있고 충돌하면 나중 것이 우선합니다.
-p String 꺼낼 때 보존하거나 버릴 파일 특성. a(접근 시각을 보존하지 않음), e(사용자 ID, 그룹 ID, 모드, 접근·수정 시각, ACL을 보존), m(수정 시각을 보존하지 않음), o(사용자 ID와 그룹 ID를 보존), p(모드를 보존)를 이어 쓰거나 -p를 여러 번 줍니다. e나 o가 없거나 ID를 보존하지 못하면 S_ISUID·S_ISGID를 정하지 않습니다. 보존에 실패하면 진단 메시지를 쓰고 종료 상태에 반영하지만 파일은 지우지 않습니다. 겹치거나 충돌하면 마지막 것이 우선합니다(예: -p eme면 수정 시각을 보존).
-r 표준 입력에서 아카이브를 읽습니다.
-s ReplacementString ed 문법의 치환 식 /old/new/[gp]로 파일·구성원 이름을 바꿉니다. old는 기본 정규식이고 new에는 &, \n 역참조를 쓸 수 있습니다. 구분자는 NULL이 아닌 어느 문자든 됩니다. 여러 번 주면 차례로 적용하다 처음 성공한 치환에서 멈춥니다. g는 ed와 같고, p는 성공한 치환을 표준 오류에 씁니다. 빈 문자열로 바뀐 이름은 무시합니다.
-t 읽은 입력 파일의 접근 시각을 읽기 전으로 되돌립니다.
-U ACL과 확장 속성을 보관하고 꺼냅니다. 대상 파일 시스템이 ACL 유형을 지원하지 않으면 지원하는 유형으로 바꾸고, EA를 지원하지 않으면 복사하지 않습니다. 목록 모드에서는 확장 속성 이름과 ACL 유형을 보여 줍니다.
-u 같은 이름의 기존 파일이나 구성원보다 오래된 파일을 무시합니다. 꺼낼 때는 아카이브 쪽이 새것일 때만 꺼내고, 쓸 때는 파일 쪽이 새것일 때만 바꾸며(-a면 덧붙여서), 복사할 때는 원본이 새것일 때만 대상을 바꾸거나 링크합니다.
-v 처리 정보를 씁니다. -r도 -w도 없으면 자세한 목차를, 아니면 구성원 경로를 표준 오류에 씁니다.
-w 지정한 아카이브 형식으로 파일을 표준 출력에 씁니다.
-x Format 출력 아카이브 형식(기본 ustar). pax(pax 교환 형식, 문자 특수 파일 기본 블록 10240), cpio(확장 cpio, 기본 5120), ustar(확장 tar, 기본 10240). 블록은 512~32256에서 512 단위로 지원합니다. 경로+이름은 PATH_MAX까지, gid·uid는 UINTMAX까지 지원하며 넘으면 보관하지 않거나 잘립니다. 기존 아카이브와 다른 형식으로 덧붙이려 하면 바로 오류로 끝나고, 복사 모드에서 -x가 없으면 -x pax인 것처럼 동작합니다.
-X 경로를 순회할 때 장치 ID가 다른 디렉터리로 내려가지 않습니다(다른 파일 시스템을 넘지 않음).
-Z EFS 파일·디렉터리의 EFS 정보를 보관합니다. 꺼낼 때는 기본으로 EFS 정보를 꺼냅니다. 목록에서 -Z로 보관한 암호화 파일은 모드 뒤에 e, 다른 파일은 -가 보입니다. -Z로 만든 아카이브는 AIX 6.1 이후에서만 풀 수 있습니다. 6.1부터

-o 키워드:

키워드 설명
datastream=pathname,datastr_size=size (모든 형식) 들어오는 데이터가 파일 형식이 아니라 표준 입력의 데이터 스트림이며, -x 형식의 보통 파일로 보관합니다. pathname은 스트림의 파일 이름(실행한 사람, 그룹, umask를 포함해야 함), size는 바이트 수로 기본값이 없어 꼭 줘야 합니다. 데이터가 size보다 짧으면 NULL로 채우고, 길면 size에서 자릅니다.
delete=pattern (-x pax) 쓰기·복사 모드에서는 pattern과 맞는 키워드를 확장 헤더에서 빼고, 읽기·목록 모드에서는 무시합니다. 예: -o delete=security.*
exthdr.name=string (-x pax) 확장 헤더 레코드의 ustar 헤더에 쓸 이름. %d(디렉터리 이름), %f(파일 이름), %%. 기본 %d/PaxHeaders/%f.
globexthdr.name=string (-x pax) 전역 확장 헤더 레코드의 이름. %n(1부터 시작하는 순서 번호), %%. 기본 $TMPDIR/GlobalHead.%n(TMPDIR이 없으면 /tmp).
invalid=action (-x pax) 확장 헤더 값이 대상에서 올바르지 않거나(읽기·복사) 현재 로캘로 쓸 수 없을 때(목록)의 동작. bypass(기본, 건너뜀), rename(그 파일에 -i처럼 새 이름을 물음), UTF8(UTF8 인코딩 그대로 씀), write(이름을 바꾸거나 잘라 씀, 기존 파일을 덮어쓸 수 있음). 덮어쓰기는 -p, -u, -k의 제한을 받습니다.
linkdata (-x pax) 쓰기 모드에서 이미 내용을 쓴 파일의 하드 링크여도 내용을 다시 씁니다.
listopt=format (모든 형식) 목록 모드에서 -v의 목차 출력 형식. 마지막 키워드-값 쌍이어야 하며 그 뒤는 모두 형식 문자열입니다. 아래 "목록 모드 형식 지정"을 봅니다.
times (-x pax) 쓰기·복사 모드에서 파일마다 atime, ctime, mtime 확장 헤더를 넣습니다.

-x pax 형식의 확장 헤더 키워드는 두 방식으로 -o에 줄 수 있습니다. keyword=value는 쓰기·복사에서는 전역 확장 헤더에 쓰고 읽기·목록에서는 전역 헤더에 있는 것처럼 동작해, 따로 값이 없는 모든 파일에 적용됩니다. keyword:=value는 쓰기·복사에서는 파일마다의 확장 헤더에 쓰고, 읽기·목록에서는 파일마다 헤더에 있는 것처럼 동작해 다른 값을 덮어씁니다.

키워드 뜻
atime, ctime, mtime 파일의 접근·생성·수정 시각(st_atime, st_ctime, st_mtime). mtime은 헤더의 mtime을 덮어쓰며 권한이 있으면 되살립니다.
charset 파일 데이터를 인코딩한 문자 집합(ISO/IEC 646 IRV, ISO 8859-1·2, ISO/IEC 10646, UTF8, BINARY). 정보용이며 데이터를 바꾸지는 않습니다.
comment 주석. pax는 무시합니다.
gid, gname 그룹 ID(10진수), 그룹 이름. 쓰기·복사에서 그룹 ID가 99,999,999보다 크거나 그룹 이름을 이식 가능 문자로 나타낼 수 없으면 넣습니다. gname은 UTF8에서 받는 쪽 문자 집합으로 바꾸며, 바꿀 수 없고 -o invalid=UTF8이 없으면 결과는 정해지지 않습니다.
uid, uname 사용자 ID, 사용자 이름. 기준과 동작은 gid, gname과 같습니다.
linkpath 앞서 보관한 파일로의 링크 경로. 헤더의 linkname을 덮어쓰며, 하드·심볼릭 여부는 ustar 헤더가 정합니다.
path 파일 경로. 헤더의 name·prefix를 덮어쓰며, 이식 가능 문자로 나타낼 수 없는 경로면 넣습니다.
size 파일 크기(옥텟). 999,999,999,999보다 크면 넣습니다.
realtime.*, security.* 앞으로의 POSIX 표준용으로 예약. 알아보지만 조용히 무시합니다.

값이 비어 있으면 같은 이름의 헤더 필드나 앞의 확장·전역 헤더 값을 지웁니다. 확장 헤더 키워드가 ustar 헤더 필드를 덮어쓰거나 지우면 그 헤더 필드는 무시합니다.

읽기·목록 모드에서 파일 속성은 다음 순서로 정합니다.

  1. -o delete=keyword-prefix면 해당하면 7단계로 정하고, 아니면 무시합니다.
  2. -o keyword:=(빈 값)면 무시합니다.
  3. -o keyword:=value면 그 값을 씁니다.
  4. 파일별 확장 헤더에 값이 있으면 그 값을 씁니다(충돌하면 마지막 것).
  5. -o keyword=value면 그 값을 씁니다.
  6. 전역 확장 헤더에 값이 있으면 그 값을 씁니다(충돌하면 마지막 것).
  7. 그 밖에는 ustar 헤더에서 정합니다.
영어 원문
  • -a — Appends files to the end of an archive. Note: Streaming tape devices do not allow the append function.
  • -b Blocking — Specifies the block size for output. The Blocking parameter specifies a positive decimal integer value that specifies the number of bytes per block. Application conforming to POSIX2 should not specify a blocksize value greater than 32256. Devices and archive formats may impose restrictions on blocking. Blocking is automatically determined on input. Default blocking when the archives are created depends on the archive format. (see the -x flag definition.) The Blocking parameter accepts one of the following value: Integer b Specifies that the block size, in bytes, be the value of the positive decimal integer that is specified by the Integer parameter that is multiplied by 512. Integer k Specifies that the block size, in bytes, be the value of the positive decimal integer that is specified by the Integer parameter that is multiplied by 1024. Integer m Specifies that the block size, in bytes, be the value of the positive decimal integer that is specified by the Integer parameter that is multiplied by 1024 x 1024. Integer+Integer Specifies that the block size, in bytes, be the sum of the positive decimal integers that are specified by the Integer parameters.
  • -c — Matches all file or archive members except the files that are specified by the Pattern parameter.
  • -d — Causes directories being copied, archived, or extracted, to match the directory and not the contents of the directory.
  • -E — Avoids truncation of the long user and group names during addition of files to a new or existing archive.
  • -f Archive — Specifies the path of an archive file to be used instead of standard input (when the -w flag is not specified) or standard output (when the -w flag is specified but the -r flag is not). When specified with the -a flag option, any files that are written to the archive are appended to the end of the archive.
  • -H — If a symbolic link that refers to a directory is specified on the command line, pax archives the file hierarchy that is rooted in the directory that is referenced in the link, by using the name of the link as the name of the file hierarchy. By default, pax archives the symbolic link itself.
  • -i — Renames files or archives interactively. For each archive member that matches the Pattern parameter or file that matches a File parameter, a prompt is written to the display device that contains the name of a file or archive member. A line is then read from the display device. If this line is empty, the file or archive member is skipped. If this line consists of a single period, the file or archive member is processed with no modification to its name. Otherwise, its name is replaced with the contents of the line.
  • -k — Prevents the pax command from writing over existing files.
  • -l — Links files when copying files. Hard links are established between the source and destination file hierarchies whenever possible.
  • -L — If a symbolic link that refers to a directory is specified on the command line or encountered during the traversal of a file hierarchy, pax archives the file hierarchy that is rooted in the directory that is referenced in the link, by using the name of the link as the name of the file hierarchy. By default, pax archives the symbolic link itself.
  • -n — Selects the first archive member that matches each Pattern parameter. No more than one archive member is matched for each pattern.
  • -o Options — Modifies the archiving algorithm according to the keyword-value pairs specified in the Options parameter. The keyword-value pairs must be in the following format: keyword:=value,keyword:=value,... Some keywords apply only to certain file formats, as indicated with each description. Use of keywords that are inapplicable to the file format being processed will be ignored by pax. Keywords can be preceded with white space. The value field consists of zero or more characters; within value, any literal comma must be preceded with a backslash (\). A comma as the final character, or a comma that is followed by white space as the final character, in Options is ignored. Multiple -o options can be specified. If keywords given to these multiple -o options conflict, the keywords and values that appear later in the command-line sequences take precedence. The earlier values are ignored. The following keyword-value pairs are supported for the indicated file formats: datastream=pathname,datastr_size=size (Applicable to all file formats.) The datastream keyword indicates that the incoming archive file is not in a file format; instead, it is a DataStream from the standard input device. Consequently, the data must be archived as a regular file in a format that is recognized by the -x flag. The file name of the DataStream must be specified in the pathname parameter and must include the identification of the person who invoked the command, the group identification, and the umask for the file mode. Note: The datastream keyword does not have a default variable size. You must specify one. The datastr_size keyword denotes the size of the DataStream input in bytes by using decimal digits. If the pax command reaches the end of file (EOF) character before it reads the size parameter, it pads the archive file with null values. The null values make the archive file the same size as specified by the size parameter. If the data in the archive file exceeds the size that is specified, the pax command truncates the archive file to the size specified by the size parameter. The pax command also stops taking input and closes the archive file. Note: You can specify multiple instances of keyword pairs. If you assign different values to the same keyword, the pax command uses the last value that is assigned to the keyword to run the -o flag. delete=pattern (Applicable only to the -x pax format.) When used in write or copy mode, pax omits any keywords matching pattern from the extended header records that it produces. When used in read or list mode, pax ignores any keywords matching pattern in the extended header records. In all cases, matching is done using standard shell pattern-matching notation. For example, -o delete=security.* suppresses security-related information.
  • -o Options (Continued) — exthdr.name=string (Applicable only to the -x pax format.) This keyword allows user control over the name written into the ustar header blocks for the extended header records. The name is the contents of string after the following character substitutions have been made: string includes: Replaced by: %d The directory name of the file, equivalent to the result of the dirname utility on the translated pathname %f The filename of the file, equivalent to the result of the basename utility on the translated pathname %% A %% character Any other % characters in string produce undefined results. If this keyword-value pair is not specified in the -o Options list, the default value of the name is: %d/PaxHeaders/%f globexthdr.name=string (Applicable only to the -x pax format.) When used in write or copy mode with the appropriate options, pax creates global extended header records with ustar header blocks that will be treated as regular files by previous versions of pax. This keyword allows user control over the name that is written into the ustar header blocks for global extended header records. The name is the contents of string after the following character substitutions have been made: string includes: Replaced by: %n An integer that represents the sequence number of the global extended header record in the archive starting at 1 %% A % character Any other % characters in string produce undefined results. If this keyword-value pair is not specified in the -o Options list, the default value of the name is $TMPDIR/GlobalHead.%n where $TMPDIR is either the value of the TMPDIR environment variable or /tmp if TMPDIR is unset. invalid=action (Applicable only to the -x pax format.) This keyword allows user control over the action pax takes upon encountering values in an extended header record that: • in read or copy mode, are invalid in the destination hierarchy, or • in list mode, cannot be written in the code set and current locale.
  • -o Options (Continued) — pax recognizes these invalid values: • In read or copy mode, a file name or link name that contains character encodings invalid in the destination hierarchy. (For example, the name may contain embedded NULLs.) • In read or copy mode, a file name or link name that is longer than the maximum allowed in the destination hierarchy (for either a path name component or the entire path name). • In list mode, any character string value (file name, link name, user name, and so on) that cannot be written in the code set and current locale. These mutually exclusive values of the action argument are supported: • bypass In read or copy mode, pax bypasses the file, causing no change to the destination hierarchy. In list mode, pax writes all requested valid values for the file, but its method for writing invalid values is unspecified. • rename In read or copy mode, pax acts as if the -i flag is in effect for each file with invalid file name or link name values, allowing the user to provide a replacement name interactively. In list mode, pax behaves identically to the bypass action. • UTF8 When used in read, copy, or list mode and a file name, link name, owner name, or any other field in an extended header record cannot be translated from the pax UTF8 code set format to the current code set and locale, pax uses the actual UTF8 encoding for the name. • write In read or copy mode, pax writes the file, translating or truncating the name, regardless of whether this may overwrite an existing file with a valid name. In list mode, pax behaves identically to the bypass action. If no -o invalid=action is specified, pax acts as if the bypass action is specified. Any overwriting of existing files that may be allowed by the -o invalid=actions is subject to permission (-p) and modification time (-u) restrictions, and is suppressed if the -k flag is also specified. linkdata (Applicable only to the -x pax format.) In write mode, the pax command writes the contents of a file to the archive, even when that file is a hard link to a file whose contents are written to the archive.
  • -o Options (Continued) — listopt=format (Applicable to all file formats.) This keyword specifies the output format of the table of contents that are produced when the -v option is specified in list mode. To avoid ambiguity, this keyword-value pair must be used as the only or final keyword-value pair following the -o flag; all characters in the remainder of the option-argument are considered part of the format string. If multiple -o listopt=format options are specified, the format strings are considered to be a single, concatenated string, evaluated in command-line order. See the List-Mode Format Specifications section for more information. times (Applicable only to the -x pax format.) When used in write or copy mode, pax includes atime, ctime, and mtime extended header records for each file.
  • Extended header keywords

(Applicable only to the -x pax format.)

If the -x pax format is specified, the keywords and values that are defined in the list below can be used as parameters to the -o flag, in either of two modes:

keyword=value

When used in write or copy mode, these keyword-value pairs are written into the global extended header records of the new archive. When used in read or list mode, these keyword-value pairs act as if they were present in the global extended header records of the archive that is being read. In both cases, the given value is applied to all files that do not have a value that is assigned in their individual extended header records for the specified keyword.

keyword:=value

When used in write or copy mode, these keyword-value pairs are written into the extended header records of each file in the new archive. When used in read or list mode, these keyword-value pairs act as if they were present in the extended header records of each file in the archive that is being read. In both cases, the given value overrides any value for the specified keyword that is found in global or file-specific extended header records.

atime

The file access time for the following files, equivalent to the value of the st_atime member of the stat structure for a file.

charset

The name of the character is set to encode the data in the following files. The entries in this table are defined to refer to known standards:

  • value — Formal Standard
  • "ISO-IR 646 1990" — ISO/IEC 646 IRV
  • "ISO-IR 8859 1 1987" — ISO 8859-1
  • "ISO-IR 8859 2 1987" — ISO 8859-2
  • "ISO-IR 10646 1993" — ISO/IEC 10646
  • "ISO-IR 10646 1993 UTF8" — ISO/IEC 10646, UTF8 encoding
  • "BINARY" — None

The encoding is included in an extended header for information only; when pax is used as described, it does not translate the file data into any other encoding. The BINARY entry indicates binary data that is not encoded.

comment

A series of characters used as a comment. All characters in the value field are ignored by pax.

ctime

The file creation time for the following file(s), equivalent to the value of the st_ctime member of the stat structure for a file.

gid

The group ID of the group that owns the file, expressed as a decimal number by using digits from ISO/IEC 646. This record overrides the gid field in the following header block(s). When used in write or copy mode, pax includes a gid extended header record for each file whose group ID is greater than 99,999,999.

gname

The group of the following file(s), formatted as a group name in the group database. This record overrides the gid and gname fields in the following header blocks, and any gid extended header record. When used in read, copy, or list mode, pax translates the name from the UTF8 encoding in the header record to the character set appropriate for the group database on the receiving system. If any of the UTF8 characters cannot be translated, and if the -o invalid=UTF8 option is not specified, the results are undefined. When used in write or copy mode, pax includes a gname extended header record for each file whose group name cannot be represented entirely with the letters and digits of the portable character set.

linkpath

The path name of a link that is created to another file, of any type, previously archived. This record overrides the linkname field in the following ustar header block(s).

The following ustar header block determines the type of link that is created, whether hard or symbolic. In the latter case, the linkpath value is the contents of the symbolic link. pax translates the name of the link (contents of the symbolic link) from the UTF8 encoding to the character set appropriate for the local file system.

When used in write or copy mode, pax includes a link path extended header record for each link whose path name cannot be represented entirely with the members of the portable character set other than NULL.

mtime

The file modification time of the following file(s), equivalent to the value of the st_mtime member of the stat structure for a file. This record overrides the mtime field in the following header block(s). The modification time is restored if the process has the appropriate privilege to do so.

path

The pathname of the following file(s). This record overrides the name and prefix fields in the following header block(s). pax translates the path name of the file from the UTF8 encoding to the character set appropriate for the local file system. When used in write or copy mode, pax includes a path extended header record for each file whose path name cannot be represented entirely with the members of the portable character set other than NULL.

realtime.any

The keywords that are prefixed by real time are reserved for future POSIX real-time standardization. pax recognizes but silently ignores them.

security.any

The keywords that are prefixed by security are reserved for future POSIX security standardization. pax recognizes but silently ignores them.

size

The size of the file in octets, expressed as a decimal number using digits from ISO/IEC 646. This record overrides the size field in the following header block(s). When used in write or copy mode, pax includes a size of extended header record for each file with a size value greater than 999,999,999,999.

uid

The user ID of the user that owns the file, expressed as a decimal number using digits from ISO/IEC 646.. This record overrides the uid field in the following header block(s). When used in write or copy mode, pax includes a uid extended header record for each file whose owner ID is greater than 99,999,999.

uname

The owner of the following file(s), formatted as a user name in the user database. This record overrides the uid and uname fields in the following header block(s), and any uid extended header record. When used in read, copy, or list mode, pax translates the name from the UTF8 encoding in the header record to the character set appropriate for the user database on the receiving system. If any of the UTF8 characters cannot be translated, and if the -o invalid=UTF8 option is not specified, the results are undefined. When used in write or copy mode, pax includes a uname extended header record for each file whose user name cannot be represented entirely with the letters and digits of the portable character set.

If the value field is zero length, it deletes any header block field, previously entered extended header value, or global extended header value of the same name.

If a keyword in an extended header record (or in a -o option-argument) overrides or deletes a corresponding field in the ustar header block, pax ignores the contents of that header block field.

Extended header keyword precedence

(Applicable only to the -x pax format.)

This section describes the precedence in which the various header records and fields and command-line options are selected to apply to a file in the archive. When pax is used in read or list modes, it determines a file attribute in this sequence:

  1. If -o delete=keyword-prefix is used, the affected attribute is determined from step (7) if applicable, or ignored otherwise.

  2. If -o keyword:=NULL is used, the affected attribute is ignored.

  3. If -o keyword:=value is used, the affected attribute is assigned the value.

  4. If value exists in a file-specific extended header record, the affected attribute is assigned the value. When extended header records conflict, the last one given in the header takes precedence.

  5. If -o keyword=value is used, the affected attribute is assigned the value.

  6. If a value exists in a global extended header record, the affected attribute is assigned the value. When global extended header records conflict, the last one given in the global header takes precedence.

  7. Otherwise, the attribute is determined from the ustar header block.

  • -p String — Specifies one or more file characteristics to be retained or discarded on extraction. The String parameter consists of the characters a, e, m, o, and p. Multiple characteristics can be concatenated within the same string and multiple -p flags can be specified. The specifications have the following meanings: a Does not retain file-access times. e Retains the user ID, group ID, file mode, access time, modification time, and ACLs. m Does not retain file-modification times. o Retains the user ID and the group ID. p Retains the file modes. If neither the -e nor the -o flag is specified, or the user ID and group ID are not preserved for any reason, the pax command does not set the S_ISUID and S_ISGID bits of the file mode. If the retention of any of these items fails, the pax command writes a diagnostic message to standard error. Failure to retain any of the items affects the exit status, but does not cause the extracted file to be deleted. If specification flags are duplicated or conflict with each other, the last flag that is specified takes precedence. For example, if -p eme is specified, file-modification times are retained.
  • -r — Reads an archive file from the standard input.
  • -s ReplacementString — Modifies file or archive-member names that are specified by the Pattern or File parameters according to the substitution expression ReplacementString, by using the syntax of the ed command. The substitution expression has the following format: -s /old/new/[gp] where (as in the ed command), old is a basic regular expression and new can contain an & (ampersand), \n (n is a digit) back references, or subexpression matching. The old string can also contain new-line characters. Any non-null character can be used as a delimiter (the / (backslash) is the delimiter in the example). Multiple -s flag expressions can be specified; the expressions are applied in the order specified, terminating with the first successful substitution. The optional trailing g character performs as in the ed command. The optional trailing p character causes successful substitutions to be written to standard error. File or archive-member names that substitute to the empty string are ignored when reading and writing archives.
  • -t — Causes the access times of input files to be the same as they were before being read by the pax command.
  • -U — Performs archival and extraction of ACL and Extended Attributes. Attributes include Access control list (ACL) also. If the ACL type is not supported on the Target filesystem then it is converted to the ACL type supported by the Target filesystem. If the EA is not supported on the filesystem then it is not copied. When listing members of the archive this option will list the names of any named extended attributes and the type of any ACLs associated with each file that are part of the archive image.
  • -u — Ignores files that are older than a preexisting file or archive member with the same name. • When extracting files, an archive member with the same name as a file in the file system is extracted if the archive member is newer than the file. • When writing files to an archive file, an archive member with the same name as a file in the file system is superseded if the file is newer than the archive member. If the -a flag is specified this is accomplished by appending to the archive. Otherwise it is unspecified if this is accomplished by actual replacement in the archive or by appending to the archive. • When copying files to a destination directory, the file in the destination hierarchy is replaced by the file in the source hierarchy or by a link to the file in the source hierarchy if the file in the source hierarchy is newer.
  • -v — Writes information about the process. If neither the -r or -w flags are specified, the -v flag produces a verbose table of contents; otherwise, archive member path names are written to standard error.
  • -w — Writes files to the standard output in the specified archive format.
  • -x Format — Specifies the output archive format with the default format being ustar. The pax command recognizes the following formats: pax The pax interchange format. The default blocking value for this format for character-special archive files is 10240. Blocking values of 512 - 32256 in increments of 512 are supported. cpio Extended cpio interchange format. The default blocking value for this format for character-special archive files is 5120. Blocking values of 512 -32256 in increments of 512 are supported. ustar Extended tar interchange format. The default blocking value for this format for character-special archive files is 10240. Blocking values of 512 -32256 in increments of 512 are supported. • Filename: The pax command supports the length of the path and the file name until the PATH_MAX limit that is defined by the system is reached. If the length of the path and the file name input exceeds the PATH_MAX limit, then the values are not archived. • gid or uid: The pax command supports the values of gid and uid until the UINTMAX limit is reached. Values greater than the UINTMAX limit are truncated. If you attempt to append an archive file with a format that is different from the existing archive format causes the pax command to exit immediately with a nonzero exit status. In copy mode, if no -x format is specified, pax behaves as if -x pax were specified.
  • -X — When traversing the file hierarchy specified by a pathname, the pax command does not descend into directories that have a different device ID.
  • -Z — Archives the Encrypted File System (EFS) information of encrypted files or directories. The EFS information is extracted by default. When members of the archive are listed, an e indicator is displayed after the file mode for encrypted files and directories that were archived with the -Z flag, and a hyphen (-) is displayed for other files. Note: Archives created with the -Z flag can be restored only on AIX 6.1 or later releases.

플래그의 상호 작용과 처리 순서

파일이나 구성원 이름에 작용하는 플래그(-c, -i, -n, -s, -u, -v)는 다음처럼 함께 동작합니다.

  • 꺼낼 때는 사용자가 준 패턴에 -c, -n, -u를 적용해 구성원을 고른 뒤, -s, -i 순서로 이름을 바꿉니다. -v는 바뀐 이름을 씁니다.
  • 아카이브에 쓰거나 복사할 때는 사용자가 준 경로에 -n(복사 모드에는 쓸 수 없음)과 -u를 적용해 파일을 고른 뒤, -s, -i 순서로 이름을 바꾸고 -v가 바뀐 이름을 씁니다.
  • -u와 -n을 함께 주면 비교 대상보다 새것인 파일만 고른 것으로 봅니다.
영어 원문

The flags that operate on the names of files or archive members (-c, -i, -n, -s, -u, and -v) interact as follows:

  • When extracting files, archive members are selected according to the user-specified pattern parameters as modified by the -c, -n, and -u flags. Then, any -s, and -i flags modify, in that order, the names of the selected files. The -v flag writes the names resulting from these modifications.

  • When writing files to an archive file, or when copying files, the files are selected according to the user-specified pathnames as modified by the -n (this option is not valid for Copy Mode) and -u flags. Then, any -s, and -i flags modify, in that order, the names resulting from these modifications. The -v flag writes the names resulting from the modification.

  • If both the -u and -n flags are specified, the pax command does not consider a file selected unless it is newer than the file to which it is compared.

목록 모드 형식 지정

목록 모드에서 -o listopt=format을 주면 고른 파일마다 format을 적용하고 줄바꿈을 붙입니다. format은 printf()의 형식 문자열과 같되 다음이 다릅니다.

  1. 형식 변환 지정자 앞에 (keyword)를 둘 수 있으며, 변환 인수는 그 키워드의 값입니다. ustar·cpio 헤더 필드 이름과 확장 헤더 키워드를 쓸 수 있습니다(예: %(charset)s). 값은 UTF8에서 로컬 문자 집합으로 바꿔 씁니다.
  2. 변환 문자 T는 시간 형식입니다. 앞에 (keyword=subformat)를 둘 수 있고(subformat은 date 형식), 기본 키워드는 mtime, 기본 형식은 %b %e %H:%M %Y입니다.
  3. 변환 문자 M은 ls -l처럼 파일 모드 문자열입니다. 키워드가 없으면 mode이며, %.1M은 항목 유형 문자 하나입니다.
  4. 변환 문자 D는 블록·특수 파일의 장치입니다. 해당하지 않으면 키워드가 있으면 %(keyword)u, 없으면 공백입니다.
  5. 변환 문자 F는 경로 이름입니다. 앞에 쉼표로 나눈 키워드를 둘 수 있고, 비지 않은 값을 /로 이어 붙입니다. 기본은 path 키워드가 있으면 그것, 없으면 prefix,name입니다.
  6. 변환 문자 L은 심볼릭 링크를 펼칩니다. 심볼릭 링크면 "%s -> %s"(키워드 값, 링크 내용), 아니면 %F와 같습니다.
영어 원문

In list mode with the -o listopt=format option, the format argument is applied for each selected file. pax appends a newline character to the listopt output for each selected file. The format argument is used as the format string described in printf(), with the following exceptions:

  1. The sequence keyword can occur before a format conversion specifier. The conversion argument is defined by the value of keyword. The following keywords are supported:
  • Any of the field name entries for ustar and cpio header blocks.

  • Any keyword defined for the extended header or provided as an extension within the extended header. For example, the sequence %(charset)s is the string value of the name of the character set in the extended header. The result of the keyword conversion argument is the value from the applicable header field or extended header, without any trailing NULLs. All keyword-values used as conversion arguments are translated from the UTF8 encoding to the character set appropriate for the local file system, user database, etc., as applicable.

  1. An additional conversion character, T, specifies time formats. The T conversion character can be preceded by the sequence keyword=subformat, where subformat is a date format allowed by the date command. The default keyword is mtime and the default subformat is: %b %e %H:%M %Y.

  2. An additional conversion character, M, specifies the file mode string as displayed by the ls -l command. If keyword is omitted, the mode keyword is used. For example, %.1M writes the single character corresponding to the entry type field of the ls -l command.

  3. An additional conversion character, D, specifies the device for block or special files, if applicable. If not applicable and keyword is specified, then this conversion is equivalent to %keyword u. If not applicable and keyword is omitted, this conversion is equivalent to <space>.

  4. An additional conversion character, F, specifies a pathname. The F conversion character can be preceded by a sequence of comma-separated keywords: keyword,keyword... The values for all the non-null keywords are concatenated together, each separated by a /. The default is path if the keyword path is defined; otherwise, the default is prefix,name.

  5. An additional conversion character, L, specifies a symbolic link expansion. If the current file is a symbolic link, then %L expands to: "%s -> %s", value_of_keyword, contents_of_link Otherwise, the %L conversion character is equivalent to %F.

종료 상태

값 뜻
0 성공
0보다 큼 오류
영어 원문

This command returns the following exit values:

  • 0 — Successful completion.
  • >0 — An error occurred.

보안

RBAC 사용자와 Trusted AIX 사용자는 주의하세요. 이 명령은 특권 작업을 할 수 있으며, 특권 작업은 특권 사용자만 할 수 있습니다. 특권과 권한 목록은 lssecattr 명령이나 getcmdattr 하위 명령으로 봅니다(6.1 문서에만 있음).

영어 원문

Attention RBAC users and Trusted AIX users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.

예제

명령 하는 일
mkdir newdir; pax -rw olddir newdir olddir 디렉터리 계층을 newdir로 복사
pax -wf /dev/rmt0 현재 디렉터리 내용을 테이프에 씀
pax -wvf/dev/rfd0 -s /xxx/XXX/p xxx 파일 xxx를 XXX로 보관하고 성공한 치환을 보여 줌(-s/x/X/gp로도 됨)
pax -v -o listopt="start %F end" -f pax.ar 아카이브 pax.ar의 파일을 지정한 형식으로 나열
pax -wf pax.ar -x pax file1 pax 형식으로 아카이브 pax.ar을 만듦
pax -rvf pax.ar -x pax -o path=newfilename pax 형식 아카이브에서 파일을 새 경로로 꺼냄
pax -rwL srclink destdir 심볼릭 링크가 가리키는 내용을 복사
pax -rvf pax.ar -x pax -o gname=bin 그룹 이름을 bin으로 해서 꺼냄
pax -rvf pax.ar -o delete=path 꺼낼 때 pax 형식 아카이브의 경로 이름(path 키워드)을 무시
pax -wEf file.pax file 긴 사용자·그룹 이름을 자르지 않고 보관
mkdir newdir; pax -rUw olddir newdir ACL과 EA까지 olddir를 newdir로 복사

표준 입력을 정해진 크기의 데이터 스트림 파일로 보관합니다.

bash
dd if=/dev/hd6 bs=36b count=480 | pax -wf /dev/rfd0 -o datastream=_filename_,datastr_size=_size_

자주 쓰는 형태:

bash
cd /data && pax -wvf /backup/app.pax -x pax ./app       # 큰 파일·긴 이름도 보관
pax -vf /backup/app.pax | more                          # 목록
cd /restore && pax -rvf /backup/app.pax -p e            # 소유자·모드·시각·ACL 보존하며 풀기
pax -rvf /backup/app.pax -s ',^\./app,./app_old,'       # 경로를 바꿔 풀기
pax -rw -p e -X /data /newfs                            # 같은 파일 시스템 안만 복사
영어 원문
  1. To copy the olddir directory hierarchy to newdir, enter:
mkdir newdir
pax -rw olddir newdir
  1. To copy the contents of the current directory to the tape drive, enter:
pax -wf /dev/rmt0
  1. To archive the file xxx as XXX and display the successful substitution, enter one of the following commands: • pax -wvf/dev/rfd0 -s /xxx/XXX/p xxx
  • pax -wvf/dev/rfd0 -s/x/X/gp xxx
  1. To read a file from a standard input and dump it to a datastream file with a specified size, enter:
dd if=/dev/hd6 bs=36b count=480 | pax -wf /dev/rfd0 -o
datastream=_filename_,datastr_size=_size_
  1. To list the files in an archive pax.ar in a specified format, enter:
pax -v -o listopt="start %F end" -f pax.ar
  1. To create an archive pax.ar in pax format, enter :
pax -wf pax.ar -x pax file1
  1. To extract a file from an archive pax.ar in pax format with a new path, enter :
pax -rvf pax.ar -x pax -o path=newfilename
  1. To copy the contents of a symbolic link from source to destination, enter:
pax -rwL srclink destdir
  1. To extract files from the archive with group name as bin, enter:
pax -rvf pax.ar -x pax -o gname=bin
  1. To ignore the path name from the archive in pax format during extraction, enter:
pax -rvf pax.ar -o delete=path
  1. To avoid the truncation of long user and group names while creating the archive, enter:
pax -wEf file.pax file
  1. To copy the olddir directory hierarchy to newdir with ACL and EA associated with the files, enter:
mkdir newdir
pax -rUw olddir newdir

파일

파일 설명
/usr/bin/pax pax 명령
영어 원문
  • /usr/bin/pax — Contains the pax command.

Related reference:

  • rmt Command

Related information:

  • ed command
  • cpio command
  • tar command
  • Files command

리눅스(GNU)와 다른 점

리눅스에도 pax(패키지 pax)가 있으며 -r, -w, -rw, -f, -s, -x ustar|cpio의 뜻이 같습니다. 다만 리눅스에서는 tar 아카이브를 보통 GNU tar로 다루며, GNU tar도 --format=pax로 pax 형식을 쓸 수 있습니다. bsdtar(libarchive)도 -x pax 같은 형식을 지원합니다.