1. zip 혹은 unzip 설치
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | $ sudo apt-get install zip Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: linux-headers-4.10.0-28 linux-headers-4.10.0-28-generic linux-image-4.10.0-28-generic linux-image-extra-4.10.0-28-generic Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: unzip The following NEW packages will be installed: unzip zip 0 upgraded, 2 newly installed, 0 to remove and 14 not upgraded. Need to get 317 kB of archives. After this operation, 1,117 kB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://kr.archive.ubuntu.com/ubuntu xenial/main amd64 unzip amd64 6.0-20ubuntu1 [158 kB] Get:2 http://kr.archive.ubuntu.com/ubuntu xenial/main amd64 zip amd64 3.0-11 [158 kB] Fetched 317 kB in 0s (1,714 kB/s) Selecting previously unselected package unzip. (Reading database ... 251479 files and directories currently installed.) Preparing to unpack .../unzip_6.0-20ubuntu1_amd64.deb ... Unpacking unzip (6.0-20ubuntu1) ... Selecting previously unselected package zip. Preparing to unpack .../archives/zip_3.0-11_amd64.deb ... Unpacking zip (3.0-11) ... Processing triggers for mime-support (3.59ubuntu1) ... Processing triggers for man-db (2.7.5-1) ... Setting up unzip (6.0-20ubuntu1) ... Setting up zip (3.0-11) ... | cs |
2. 설치 확인
1 2 3 4 5 6 7 8 | $ dpkg -l |grep zip ii bzip2 1.0.6-8 amd64 high-quality block-sorting file compressor - utilities ii gzip 1.6-4ubuntu1 amd64 GNU compression utilities ii libarchive-zip-perl 1.56-2 all Perl module for manipulation of ZIP archives ii libperlio-gzip-perl 0.19-1build1 amd64 module providing a PerlIO layer to gzip/gunzip ii unzip 6.0-20ubuntu1 amd64 De-archiver for .zip files ii zip 3.0-11 amd64 Archiver for .zip files | cs |
3. zip 압축
1 2 3 4 | $ zip test.zip ./Downloads/* adding: Downloads/eclipse-installer/ (stored 0%) adding: Downloads/eclipse-inst-linux64.tar.gz (deflated 0%) | cs |
* Downloads.zip : 압축 후 생성될 파일
* ./Downloads/* : 압축할 대상 파일 혹은 디렉터리
* 현재 디렉터리 이하의 하위 디렉터리도 모두 압축하려면 -r 옵션을 추가해서 사용합니다.
4. 압축 확인
1 2 3 | $ ll -l |grep test -rw-rw-r-- 1 user user 48028337 11월 6 14:00 test.zip | cs |
5. 압축 해제
1 2 3 4 5 | $ unzip ./test.zip Archive: ./test.zip creating: Downloads/eclipse-installer/ inflating: Downloads/eclipse-inst-linux64.tar.gz | cs |
* ./test.zip : 현재 디렉터리의 test.zip 파일을 압축 해제한다는 의미입니다.
6. 압축 해제 확인
1 2 3 4 5 6 7 | $ ll total 46916 drwxrwxr-x 3 user user 4096 11월 6 14:07 ./ drwxr-xr-x 26 user user 4096 11월 6 14:05 ../ drwxrwxr-x 3 user user 4096 11월 6 14:07 Downloads/ -rw-rw-r-- 1 user user 48028337 11월 6 14:00 test.zip | cs |
7. 특정 디렉터리에 압축 해제
1 2 3 4 5 | $ unzip test.zip -d ./test Archive: test.zip creating: ./test/Downloads/eclipse-installer/ inflating: ./test/Downloads/eclipse-inst-linux64.tar.gz | cs |
* -d 옵션을 사용하게 될 경우 이하 ./test 디렉터리에 압축을 해제합니다.
* ./test 디렉터리가 존재하지 않을 경우 자동으로 생성 후 압축을 진행합니다.
8. 특정 디렉터리에 압축 해제 확인
1 2 3 4 | $ ll |grep test drwxrwxr-x 3 user user 4096 11월 6 14:08 test/ -rw-rw-r-- 1 user user 48028337 11월 6 14:00 test.zip | cs |
'Operating System > Linux' 카테고리의 다른 글
centos wget 설치 (0) | 2017.11.06 |
---|---|
ubuntu python pip 설치 (0) | 2017.11.06 |
ruby 설치 (0) | 2017.10.31 |
ubuntu desktop eclipse 설치 (0) | 2017.10.24 |
ubuntu 자바 설치 (0) | 2017.10.19 |