ubuntu : 압축 / 압축해제 - tar, zip

코일·2021년 12월 24일
0

Linux - Ubuntu ✍

목록 보기
1/1
post-thumbnail

TAR 파일

tar 파일 압축/압축해제 하기

$ tar -xvf file.tar

파일 확장자가 tar.gz인 경우

$ tar xvzf file.tar.gz

파일 확장자가 tar.tbz인 경우

$ tar xvjf file.tar.tbz

tar 파일 형식으로 압축을 하려는 경우(참고)

$ tar -czvf name-of-archive.tar.gz /path/to/directory-or-file

플래그 설명(참고):

-x : Extract a tar ball.
-v : Verbose output or show progress while extracting files.
-f : Specify an archive or a tarball filename.
-j : Decompress and extract the contents of the compressed archive created by bzip2 program (tar.bz2 extension).
-z : Decompress and extract the contents of the compressed archive created by gzip program (tar.gz extension).

ZIP 파일

zip 파일 압축/압축해제 하기

먼저 zip/unzip을 설치합니다.

$ sudo apt-get install zip unzip
  • 다음 명령을 사용하여 압축을 해제할 수 있습니다.

    	$ unzip photos.zip
  • 하나의 파일만 압축 해제

    	$ unzip photos.zip image1.png
  • 다른 폴더에 압축 해제

    	$ unzip photos.zip -d ./directory/
  • 무결성을 확신할 수 없을 때 테스트하는 방법. -t 플래그 사용

    	$ unzip -t photos.zip
  • zip 파일 내의 파일 목록을 확인하고 싶은 경우

    	$ unzip -l photos.zip
  • 문제가 발생할 경우 man 페이지 확인

    	$ man unzip
  • 압축을 하려는 경우(참고)

    	$ zip -r my_arch.zip my_folder

Ref

링크텍스트

링크텍스트

profile
How do you get what you want?🤔🤔

0개의 댓글