본문 바로가기
컴퓨터 활용(한글, 오피스 등)/50_2.운영체제_리눅스

리눅스 unzip

by 3604 2023. 11. 26.
728x90

출처: https://change-words.tistory.com/entry/%EB%A6%AC%EB%88%85%EC%8A%A4-unzip

리눅스에서도 zip 파일의 압축을 해제할 수 있습니다. unzip 명령어를 사용하면 됩니다.

 

1. 폴더에 압축 풀기

unzip 명령어를 사용하려면 압축파일에 대해 쓰기(w) 권한이 있어야 합니다. 폴더에 그대로 압축을 푸는 방법은 아래와 같습니다.

unzip File.zip

[예시]

[root@localhost test]# unzip TestFile.zip
Archive:  TestFile.zip
 extracting: test1.txt
 extracting: test2.txt
 extracting: test3.txt
[root@localhost test]# ls
test1.txt  test2.txt  test3.txt  TestFile.zip

보시는 바와 같이 test라는 폴더에 압축이 모두 풀립니다.

2. 다른 디렉토리에 압축 풀기

그러나 보통 압축 파일은 폴더에 해제하는 경우가 많습니다. 그럴 땐 -d 옵션과 경로 설정이 필요합니다. 

unzip File.zip -d path

[예시]

[root@localhost test]# unzip TestFile.zip -d /root/zipTest/test/mkdir
Archive:  TestFile.zip
 extracting: /root/zipTest/test/mkdir/test1.txt
 extracting: /root/zipTest/test/mkdir/test2.txt
 extracting: /root/zipTest/test/mkdir/test3.txt
[root@localhost test]# ls
mkdir  test1.txt  test2.txt  test3.txt  TestFile.zip

이미 있는 경로에 설정해도 되고, 없는 경로의 폴더를 지정하면 해당 폴더가 생성하면서 압축을 해제합니다. 

3. 비밀번호 있는 압축 파일 풀기

원래 하던 방식대로 압축을 해제하면 패스워드를 입력하라는 안내가 나옵니다. 패스워드를 입력하면 압축이 해제됩니다.

[root@localhost zipTest]# unzip zipFilePassword.zip
Archive:  zipFilePassword.zip
[zipFilePassword.zip] procexp64.exe password:

처음부터 패스워드를 입력해서 압축을 해제할 수도 있습니다.

[root@localhost zipTest]# unzip -P 1234 zipFilePassword.zip
Archive:  zipFilePassword.zip
728x90