unzip
압축·전송
쓰는 꼴
unzip [-d <dir>] <archive.zip>.zip을 풀어 놓습니다 — `-d`를 안 주면 지금 폴더에 그대로 쏟아지니 `-l`로 안에 상위 폴더가 있는지 먼저 보고, 옛 Windows에서 만든 것은 이름이 깨져 `-O CP932`가 필요하며, `-P`로 적은 비밀번호는 셸 기록과 ps에 그대로 남습니다.
자주 쓰는 옵션
| 옵션 | 뜻 |
|---|---|
| -l | List the contents without extracting. |
| -d <dir> | Extract there instead of into the current directory. |
| -o | Overwrite existing files without asking. |
| -n | Never overwrite: skip files that already exist. |
| -j | Flatten the paths into one directory. |
| -q | Quiet, for scripts. |
| -O CP932 | Interpret file names in a legacy code page (Debian/Ubuntu Info-ZIP only; stock macOS unzip rejects -O). |
| -P <password> | Password on the command line, where ps and your shell history can see it. |
예시
unzip -l archive.zipCheck whether it has a top-level folder before extracting.
unzip archive.zip -d /tmp/outExtract somewhere harmless.
unzip -O CP932 japanese.zipFixes mojibake from an older Windows zip, where the patched Info-ZIP is available.
압축과 묶음은 다른 일입니다. tar가 묶고 gzip이 줄이며, .tar.gz는 그 둘을 겹친 것입니다.
읽는 방법
- 대괄호 [ ]는 넣어도 되고 안 넣어도 되는 자리입니다.
- 점 셋 …은 여러 개를 이어 쓸 수 있다는 뜻입니다.
- 옵션은 대소문자를 가립니다 — -r과 -R이 다른 명령도 있습니다.
자주 묻는 것
Q. unzip은 무엇을 하나요?
.zip을 풀어 놓습니다 — `-d`를 안 주면 지금 폴더에 그대로 쏟아지니 `-l`로 안에 상위 폴더가 있는지 먼저 보고, 옛 Windows에서 만든 것은 이름이 깨져 `-O CP932`가 필요하며, `-P`로 적은 비밀번호는 셸 기록과 ps에 그대로 남습니다.
Q. 어떻게 치나요?
unzip [-d <dir>] <archive.zip> — 대괄호는 생략할 수 있는 자리입니다.
Q. 옵션은 몇 개나 자주 쓰나요?
여기 정리한 것은 8개입니다. 전체 목록은 man unzip에 있습니다. 이 명령은 압축·전송 갈래입니다.
같이 보는 명령
man 페이지: man unzip