본문 바로가기
IT기술/Linux 계열

[Linux] 리눅스 분할 압축 풀기

by Travelo 2022. 6. 13.
728x90
반응형

파일크기가 클 경우 분할 압축을 하게 되는데, 리눅스에서 분할 압축 해제 하는 방법에 대해 알아본다.

이번 포스트에선 다음과 같이 zip, unzip을 이용할 예정이다.

크게 4단계로 어렵지 않게 분할 압축 파일을 풀어낼 수 있다.

 

 

반응형
방법

다음과 같이 zip, unzip에 관련된 옵션을 확인할 수 있다.

root@ubuntu:~/MSWin10# zip --help
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
Zip 3.0 (July 5th 2008). Usage:
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
  The default action is to add or replace zipfile entries from list, which
  can include the special name - to compress standard input.
  If zipfile and list are omitted, zip compresses stdin to stdout.
  -f   freshen: only changed files  -u   update: only changed or new files
  -d   delete entries in zipfile    -m   move into zipfile (delete OS files)
  -r   recurse into directories     -j   junk (don't record) directory names
  -0   store only                   -l   convert LF to CR LF (-ll CR LF to LF)
  -1   compress faster              -9   compress better
  -q   quiet operation              -v   verbose operation/print version info
  -c   add one-line comments        -z   add zipfile comment
  -@   read names from stdin        -o   make zipfile as old as latest entry
  -x   exclude the following names  -i   include only the following names
  -F   fix zipfile (-FF try harder) -D   do not add directory entries
  -A   adjust self-extracting exe   -J   junk zipfile prefix (unzipsfx)
  -T   test zipfile integrity       -X   eXclude eXtra file attributes
  -y   store symbolic links as the link instead of the referenced file
  -e   encrypt                      -n   don't compress these suffixes
  -h2  show more help

 

root@ubuntu:~/MSWin10# unzip --help
UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.

Usage: unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]
  Default action is to extract files in list, except those in xlist, to exdir;
  file[.zip] may be a wildcard.  -Z => ZipInfo mode ("unzip -Z" for usage).

  -p  extract files to pipe, no messages     -l  list files (short format)
  -f  freshen existing files, create none    -t  test compressed archive data
  -u  update files, create if necessary      -z  display archive comment only
  -v  list verbosely/show version info       -T  timestamp archive to latest
  -x  exclude files that follow (in xlist)   -d  extract files into exdir
modifiers:
  -n  never overwrite existing files         -q  quiet mode (-qq => quieter)
  -o  overwrite files WITHOUT prompting      -a  auto-convert any text files
  -j  junk paths (do not make directories)   -aa treat ALL files as text
  -U  use escapes for all non-ASCII Unicode  -UU ignore any Unicode fields
  -C  match filenames case-insensitively     -L  make (some) names lowercase
  -X  restore UID/GID info                   -V  retain VMS version numbers
  -K  keep setuid/setgid/tacky permissions   -M  pipe through "more" pager
  -O CHARSET  specify a character encoding for DOS, Windows and OS/2 archives
  -I CHARSET  specify a character encoding for UNIX and other archives

See "unzip -hh" or unzip.txt for more help.  Examples:
  unzip data1 -x joe   => extract all files except joe from zipfile data1.zip
  unzip -p foo | more  => send contents of foo.zip via pipe into program more
  unzip -fo foo ReadMe => quietly replace existing ReadMe if archive file newer

 

1. 분할압축파일 구성 확인

이제 실제 분할 압축된 파일을 통해 분할 압축하는 방법을 알아본다.

분할압축 파일은 ~.zip, ~.z01로 구성되어 있다.

root@ubuntu:~/MSWin10# ll
total 7012248
drwxr-xr-x  2 root root       4096 Apr 26 17:09 ./
drwxr-xr-x 10 root root       4096 Apr 26 16:57 ../
-rw-r--r--  1 root root 4294963200 Apr 26 17:08 MSEdge.Win10.VirtualBox.z01
-rw-r--r--  1 root root 2885559016 Apr 26 17:06 MSEdge.Win10.VirtualBox.zip

 

2. 분할 압축파일 통합과정?

분할압축된 파일의 zip파일을 fixed 하여 통합한다.

root@ubuntu:~/MSWin10# zip -F MSEdge.Win10.VirtualBox.zip --out MSEdge.Win10.VirtualBox.zip.fixed
Fix archive (-F) - assume mostly intact archive
 copying: MSEdge.Win10.VirtualBox/
 copying: MSEdge.Win10.VirtualBox/MSEdge - Win10.ova

root@ubuntu:~/MSWin10# ll
total 14024484
drwxr-xr-x  2 root root       4096 Apr 26 17:12 ./
drwxr-xr-x 10 root root       4096 Apr 26 16:57 ../
-rw-r--r--  1 root root 4294963200 Apr 26 17:08 MSEdge.Win10.VirtualBox.z01
-rw-r--r--  1 root root 2885559016 Apr 26 17:06 MSEdge.Win10.VirtualBox.zip
-rw-r--r--  1 root root 7180522212 Apr 26 17:12 MSEdge.Win10.VirtualBox.zip.fixed

 

3. 통합 압축파일 파일 타입 변경

고쳐진? (통합) 압축파일의 파일 타입을 변경한다.

root@ubuntu:~/MSWin10# mv MSEdge.Win10.VirtualBox.zip.fixed MSEdge.Win10.VirtualBox1.zip

root@ubuntu:~/MSWin10# ll
total 11206552
drwxr-xr-x  2 root root       4096 Apr 26 17:14 ./
drwxr-xr-x 10 root root       4096 Apr 26 16:57 ../
-rw-r--r--  1 root root 4294963200 Apr 26 17:08 MSEdge.Win10.VirtualBox.z01
-rw-r--r--  1 root root 2885559016 Apr 26 17:06 MSEdge.Win10.VirtualBox.zip
-rw-r--r--  1 root root 7180522212 Apr 26 17:12 MSEdge.Win10.VirtualBox1.zip

 

4. 압축파일 해제

통합 압축파일을 unzip을 통하여 압축해제를 한다.

다음과 같이 압축하였던, MSEdge - Win10.ova 파일이 해제됨을 확인할 수 있다.

root@ubuntu:~/MSWin10# unzip MSEdge.Win10.VirtualBox.zip
Archive:  MSEdge.Win10.VirtualBox.zip
  inflating: MSEdge - Win10.ova  

root@ubuntu:~/MSWin10# ll
total 18292380
drwxr-xr-x  2 root root       4096 Apr 26 17:18  ./
drwxr-xr-x 10 root root       4096 Apr 26 16:57  ../
-rw-r--r--  1 root root 7255876608 Mar 19 20:53 'MSEdge - Win10.ova'
-rw-r--r--  1 root root 4294963200 Apr 26 17:08  MSEdge.Win10.VirtualBox.z01
-rw-r--r--  1 root root 7180522212 Apr 26 17:12  MSEdge.Win10.VirtualBox.zip
728x90
반응형

댓글