zcat 명령어 (AIX 5.3·6.1)
https://archive.horanglab.com/posts/aix-cmd-zcat
핵심 정리
compress로 만든.Z파일을 풀어 표준 출력에 씁니다..Z파일은 그대로 두고 이름도 바꾸지 않습니다.zcat 파일.Z | more,zcat 파일.Z | grep 문자열,zcat app.tar.Z | tar -xvf -처럼 파이프로 씁니다.compress -n으로 만든 파일은zcat -n을 씁니다.- AIX 기본
zcat은.Z만 풉니다. gzip 파일(.gz)은gzip -dc나gunzip -c를 씁니다(리눅스zcat은.gz를 풂).
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (두 버전의 내용이 같음) |
| 원문 | IBM Commands Reference — 5.3 Volume 6, 6.1 Volume 6 |
| 파일 | /usr/bin/zcat |
| 관련 명령어 | compress, uncompress, pcat, gzip -dc |
목적
압축한 파일을 풀어 표준 출력에 씁니다.
영어 원문
Expands a compressed file to standard output.
구문
zcat [ -n ] [ -V ] [ File ... ]
설명
zcat 명령은 압축 파일을 풀지 않고도 내용을 펼쳐 볼 수 있게 합니다. 펼친 파일의 이름을 바꾸거나 .Z를 떼지 않으며, 펼친 내용을 표준 출력에 씁니다.
영어 원문
The zcat command allows the user to expand and view a compressed file without uncompressing that file. The zcat command does not rename the expanded file or remove the .Z extension. The zcat command writes the expanded output to standard output.
플래그
| 플래그 | 설명 |
|---|---|
-n |
압축 파일에 헤더가 없는 것으로 봅니다. compress -n으로 만든 파일이면 이것을 씁니다. |
-V |
현재 버전과 컴파일 옵션을 표준 오류에 씁니다. |
영어 원문
-n— Omits the compressed file header from the compressed file. Note: Use the-noption if the file was compressed using the-noption.-V— Writes the current version and compile options to standard error.
매개변수
| 매개변수 | 설명 |
|---|---|
| File ... | 펼칠 압축 파일. |
영어 원문
- File ... — Specifies the compressed files to expand.
Return Values
다음 경우 1로 끝나며, 오류가 없으면 0입니다.
- 입력 파일이
compress로 만든 것이 아닙니다. - 입력 파일을 읽을 수 없거나 출력 파일을 쓸 수 없습니다.
영어 원문
If the zcat command exits with a status of 1 if any of the following events occur:
The input file was not produced by the compress command.
An input file cannot be read or an output file cannot be written.
If no error occurs, the exit status is 0.
종료 상태
| 값 | 뜻 |
|---|---|
| 0 | 성공 |
| 0보다 큼 | 오류 |
영어 원문
- 0 — Successful completion.
>0— An error occurred.
예제
foo.Z를 풀지 않고 봅니다. 풀린 내용이 표준 출력에 나오고 파일 이름은 바뀌지 않습니다.
zcat foo.Z
자주 쓰는 형태:
zcat old.log.Z | grep -i error
zcat app.tar.Z | tar -tvf -
gzip -dc app.tar.gz | tar -xvf - # .gz는 gzip으로
영어 원문
To view the foo.Z file without uncompressing it, enter: zcat foo.Z
The uncompressed contents of the foo.Z file are written to standard output. The file is not renamed.
Related information:
- compress command
리눅스(GNU)와 다른 점
리눅스에서도 compress·uncompress(ncompress 패키지)를 쓸 수 있지만 거의 쓰이지 않고 gzip·gunzip·zcat(또는 bzip2, xz, zstd)을 씁니다. GNU gzip -d와 zcat은 .Z 파일도 풀 수 있어 AIX에서 만든 .Z를 리눅스에서 열 때 편합니다. AIX에도 AIX Toolbox의 gzip이 흔히 설치되어 있습니다. 리눅스 zcat은 gzip -dc와 같아 .gz와 .Z를 모두 풉니다.