pack 명령어 (AIX 5.3·6.1)
https://archive.horanglab.com/posts/aix-cmd-pack
핵심 정리
- Huffman 부호로 파일을 압축해 원본을
파일.z(소문자 z)로 바꿉니다.compress의.Z와 다른 형식입니다. pack 파일....-를 파일 앞에 두면 그 파일의 압축 통계를 보여 주고, 다시-를 두면 끕니다.-f는 효과가 없어도 강제로 압축합니다.- 이미 압축됐거나, 링크가 있거나, 디렉터리거나, 줄어드는 블록이 없으면 압축하지 않습니다. 종료 값은 압축하지 못한 파일 수입니다.
- 풀기는
unpack, 내용 보기는pcat입니다.compress보다 압축률이 낮아 요즘은 거의 쓰지 않습니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (두 버전의 내용이 거의 같음) |
| 원문 | IBM Commands Reference — 5.3 Volume 4, 6.1 Volume 4 |
| 파일 | /usr/bin/pack |
| 관련 명령어 | unpack, pcat, compress |
목적
파일을 압축합니다.
영어 원문
Compresses files.
구문
pack [ -f ] [ - ] File ...
설명
pack 명령은 File 매개변수로 준 파일을 압축된 형태로 저장합니다. 입력 파일은 같은 이름에 .z를 붙인 압축 파일로 바뀝니다. 실행한 프로세스에 적절한 권한이 있으면 압축 파일은 원본의 접근 모드, 접근·수정 날짜, 소유자를 유지합니다. .z를 붙일 자리를 두려고 입력 파일 이름은 253바이트까지만 됩니다. 성공하면 원본 파일은 지워집니다. 압축한 파일은 원래 형태로 되살릴 수 있습니다.
pack의 종료 값은 압축하지 못한 파일 수입니다. 다음 경우에는 압축하지 않습니다.
- 이미 압축된 파일
- 입력 파일 이름이 253바이트를 넘음
- 링크가 있는 파일
- 디렉터리
- 열 수 없는 파일
- 압축해도 줄어드는 저장 블록이 없음
File.z라는 파일이 이미 있음.z파일을 만들 수 없음- 처리 중 I/O 오류
영어 원문
The pack command stores the file specified by the File parameter in a compressed form. The input file is replaced by a packed file with the same name and the suffix .z appended. If the invoking process has appropriate privileges, the packed file maintains the same access modes, access and modification dates, and owner as the original file. The input file name can contain no more than 253 bytes to allow space for the added .z suffix. If the pack command is successful, the original file is removed. Packed files can be restored to their original form using the compress command.
The exit value of the pack command is the number of files that it could not pack. The pack command does not pack under any of the following conditions:
The file is already packed.
The input file name has more than 253 bytes.
The file has links.
The file is a directory.
The file cannot be opened.
No storage blocks are saved by packing.
A file called File.z already exists.
The .z file cannot be created.
An I/O error occurred during processing.
플래그
| 플래그 | 설명 |
|---|---|
-f |
File을 강제로 압축합니다. 효과가 없는 파일이 섞여 있어도 디렉터리 전체를 압축할 때 쓸모 있습니다. |
영어 원문
-f— Forces packing of the file specified by the File parameter. This is useful for packing an entire directory, even if some of the files will not benefit.
매개변수
| 매개변수 | 설명 |
|---|---|
| File | 압축할 파일. |
- |
File의 통계를 보여 줍니다. 통계는 바이트 단위로 만든 Huffman 최소 중복 부호 트리로 계산합니다. 명령줄에 -가 다시 나오면 다음 파일부터 이 기능을 끄고 켭니다(예 2). |
영어 원문
- File — Specifies the file to be packed.
-— Displays statistics about the file specified by the File parameter. The statistics are calculated from a Huffman minimum redundancy code tree built on a byte-by-byte basis. Additional occurrences of the-(minus sign) parameter on the command line toggles this function for the next specified file. See example 2.
종료 상태
| 값 | 뜻 |
|---|---|
| 0 | 파일을 성공적으로 압축함 |
| 0보다 큼 | 오류 |
영어 원문
This command returns the following exit values:
- 0 — Specifies that the file was successfully packed.
>0— Specifies that an error occurred.
예제
| 명령 | 하는 일 |
|---|---|
pack chap1 chap2 |
chap1, chap2를 압축해 chap1.z, chap2.z로 바꾸고 파일마다 줄어든 비율을 보여 줌 |
pack - chap1 - chap2 |
두 파일을 압축하고 chap1의 통계만 보여 줌. 첫 -가 통계를 켜고 두 번째 -가 끔 |
영어 원문
- To compress the files named
chap1andchap2and display the revised file names, enter:
pack chap1 chap2
The compressed versions are renamed chap1.z and chap2.z. The pack command displays the percent decrease in size for each file compressed.
- To display statistics about the amount of compression done, enter:
pack - chap1 - chap2
This compresses the files named chap1 and chap2 and displays statistics about the file named chap1, but not about the file named chap2. The first - (minus sign) parameter turns on the statistic display, and the second - parameter turns it off.
파일
| 파일 | 설명 |
|---|---|
/usr/bin/pack |
pack 명령 |
영어 원문
- /usr/bin/pack — Contains the pack command.
Related reference:
- pcat Command
Related information:
- cat command
- unpack command
- Files command
- Input and output redirection
리눅스(GNU)와 다른 점
pack·unpack(Huffman 부호, .z)은 아주 오래된 형식이라 리눅스 배포판에는 거의 없습니다. GNU gzip -d가 pack 형식(.z)도 풀 수 있으니 리눅스에서 열 때는 gunzip 파일.z를 써 봅니다.