Архивирование файлов в linux

Links to Third-Party Web Sites

The WinZip Computing Web site may contain links to third-party Web sites, which are not under the control of WinZip Computing. WinZip Computing makes no representations whatsoever about any other Web site to which you may have access through the WinZip Computing Web site. When you access a non-WinZip Computing Web site, you do so at your own risk and WinZip Computing is not responsible for the accuracy or reliability of any information, data, opinions, advice, or statements made on these sites. WinZip Computing provides these links merely as a convenience and the inclusion of such links does not imply that WinZip Computing endorses or accepts any responsibility for the content or uses of such Web sites.

Распаковка ZIP Linux

Формат ZIP был создан в 1989 году на замену очень медленному формату ARC. Здесь используется сжатие deflate, и на то время оно работало намного быстрее чем ARC. Исторически сложилось так, что стандартным форматом для Linux стали TAR и GZ — это усовершенствованные алгоритмы сжатия и архивации. Многие графические распаковки воспринимают и ZIP-файлы. Но они обрабатывают архивы не сами, а дают команду предназначенным для этого формата утилитам.

Утилита для распаковки ZIP называется unzip, она не всегда установлена по умолчанию. Но вы можете очень просто добавить её в свою систему из официальных репозиториев. Для этого в Ubuntu выполните:

А в системах, использующих формат пакетов Red Hat, команда будет выглядеть немного по-другому:

После установки большинство графических утилит для работы с архивами смогут распаковать архив ZIP Linux. Команда ZIP Linux установлена на случай, если вы захотите создавать ZIP-архивы.

Но этой утилите не нужны дополнительные оболочки для распаковки архива. Вы можете сделать всё прямо из консоли. Давайте рассмотрим синтаксис утилиты:

$ unzip опции файл_архива.zip файлы -x исключить -d папка

  • файл архива — это тот файл, с которым нам предстоит работать;
  • файлы — здесь вы можете указать файлы, которые нужно извлечь, разделять имена файлов пробелом;
  • исключить — файлы, которые извлекать не нужно;
  • папка — папка, в которую будет распакован архив.

Теперь рассмотрим опции утилиты, поскольку она позволяет не только распаковывать архивы, но и выполнять с ними определённые действия:

  • -l — вывести список файлов в архиве;
  • -t — протестировать файл архива на ошибки;
  • -u — обновить существующие файлы на диске;
  • -z — вывести комментарий к архиву;
  • -c — извлекать файлы на стандартный вывод, перед каждым файлом будет выводиться его имя;
  • -p — то же самое, только имя выводится не будет;
  • -f — извлечь только те файлы, которые уже существуют на диске, и файлы в архиве более новые;
  • -v — вывести всю доступную информацию;
  • -P — указать пароль для расшифровки архива;
  • -n — не перезаписывать существующие файлы;
  • -j — игнорировать структуру архива и распаковать всё в текущую папку;
  • -q — выводить минимум информации.

Все самые основные опции рассмотрели, теперь давайте рассмотрим несколько примеров работы с программой в терминале. Чтобы распаковать ZIP Linux в текущую папку, достаточно набрать:

Причём расширение указывать не обязательно. Протестировать архив можно с помощью опции -t:

Вы можете протестировать все архивы в текущей папке, выполнив:

Если нужно распаковывать архив не в текущую папку, можно очень просто указать нужную:

Также можно распаковывать не весь архив, а только нужные файлы или файлы нужного формата:

С помощью опции -l вы можете посмотреть список файлов в архиве:

Утилиту unzip разобрали и теперь вы с ней точно справитесь. Но я говорил, что мы рассмотрим несколько способов, как выполняется распаковка ZIP Linux. Поэтому дальше мы поговорим об утилите 7z.

Демонстрация работы утилит zip и unzip в терминале:

Key Features

Support for Jpeg Compression
Create self-extracting Zip files that contain files compressed with Jpeg compression, delivering up to 25% compression of JPEG images with no loss in quality
   
Support for LZMA Compression
Create self-extracting Zip files that contain files compressed with LZMA compression, delivering powerful compression for many file types
   
Support for WavPack Compression
Create self-extracting Zip files that contain files compressed with WavPack compression, delivering lossless compression of .WAV (audio) files
   
Support for Zipx files
Create self-extracting Zip files from .zipx files that are compressed with advanced compression technology.
   
Unicode Support
To ensure international characters are displayed for filenames in a Zip file
   
  Support for Advanced Compression methods
Supports PPMd and Enhanced Deflate compressed files
   
  Icon Support
WinZip Self-Extractor supports icon sizes of 16×16, 32×32, 48×48, 96×96, 128×128, and 256×256. Vista png format icons are also supported.
   
  Administrator Options
WinZip Self-Extractor allows you to specify the privilege level at which self-extracting executables may be run. The “Run as Administrator” option lets you create self-extractors that will prompt Vista users for elevated privileges so self-extracting software installation packages have the required privilege level to run on the new OS.
   
  Support for Advanced Encryption

Create self-extracting Zip files that contain AES, 128- or 256-bit key, encrypted files.

   
  Wizard driven

WinZip Self-Extractor is wizard driven, which simplifies the process of building self-extracting Zip files.

   
  Customization

Easily create and customize your self-extracting Zip files.

   
  Customize software installations
WinZip Self-Extractor can create self-extracting Zip files for software installation using custom icons and splash screen, set up and about box text, and can run .exe, .com, .bat or .inf files to facilitate software installation. Standard self-extractors can open any file type in its associated application.
   
  Span disks

A self-extracting Zip file created by WinZip Self-Extractor can span multiple removable disks.

   
  Invoke from Start/Run command

WinZip Self-Extractor can be run from the «Start» menu’s «Run» dialog box by simply typing «wzipse32».

   
  Self-extractors for software installation

WinZip Self-Extractor can create self-extracting Zip files for software installation that can run standard Microsoft-format .INF files as an alternative to «setup» programs, and can clean up files even if the install process involves a reboot.

   
  Issue optional command after unzip

There is no practical limit on the length of the optional command issued by self-extracting Zip files after the unzip operation completes.

   
  International Language Messages

Self-extracting Zip files can be created with English or German messages.

   
  Works with Windows Vista

Buy NowDownload

Requirements:
Microsoft Windows 10, Windows 8, Windows 7, Windows Vista or Windows XP.

License Agreement

Options

unzip‘s default behavior may be modified via options placed in an environment variable. This can be done with any option, but it is probably most useful with the -a, -L, -C, -q, -o, or -n modifiers: make unzip auto-convert text files by default, make it convert filenames from uppercase systems to lowercase, make it match names case-insensitively, make it quieter, or make it always overwrite or never overwrite files as it extracts them. For example, to make unzip act as quietly as possible, only reporting errors, one would use one of the following commands:

Unix Bourne shell:

UNZIP=-qq; export UNZIP

Unix C shell:

setenv UNZIP -qq

OS/2 or MS-DOS:

set UNZIP=-qq

VMS (quotes for lowercase):

define UNZIP_OPTS "-qq"

Environment options are, in effect, considered to be just like any other command-line options, except that they are effectively the first options on the command line. To override an environment option, one may use the «minus operator» to remove it. For instance, to override one of the quiet-flags in the example above, use the command below.

unzip --q zipfile

The first hyphen is the normal switch character, and the second is a minus sign, acting on the q option. Thus the effect here is to cancel one quantum of quietness. To cancel both quiet flags, two (or more) minuses may be used:

unzip -t--q zipfile
unzip ---qt zipfile

(the two are equivalent). This may seem awkward or confusing, but it is reasonably intuitive: just ignore the first hyphen and go from there. It is also consistent with the behavior of Unix nice.

As suggested by the examples above, the default variable names are UNZIP_OPTS for VMS (where the symbol used to install unzip as a foreign command would otherwise be confused with the environment variable), and UNZIP for all other operating systems. For compatibility with zip, UNZIPOPT is also accepted. If both UNZIP and UNZIPOPT are defined, however, UNZIP takes precedence. unzip‘s diagnostic option (-v with no zipfile name) can be used to check the values of all four possible unzip and zipinfo environment variables.

The timezone variable (TZ) should be set according to the local timezone for the -f and -u to operate correctly. See the description of -f above for details. This variable may also be necessary to get timestamps of extracted files to be set correctly. The WIN32 (Win9x/ME/NT4/2K/XP/2K3) port of unzip gets the timezone configuration from the Registry, assuming it is correctly set in the Control Panel. The TZ variable is ignored for this port.

Decryption

Encrypted archives are fully supported by Info-ZIP software, but due to United States export restrictions, de-/encryption support might be disabled in your particular compiled binary. However, since the spring of 2000, US export restrictions have been liberated, and our source archives do now include full crypt code. In case you need binary distributions with crypt support enabled, see the file «WHERE» in any Info-ZIP source or binary distribution for locations both inside and outside the US.

Some compiled versions of unzip may not support decryption. To check a version for crypt support, either attempt to test or extract an encrypted archive, or else check unzip‘s diagnostic screen (see the -v option above) for «» as one of the special compilation options.

As noted above, the -P option may be used to supply a password on the command line, but at a cost in security. The preferred decryption method is to extract normally; if a zipfile member is encrypted, unzip will prompt for the password without echoing what is typed. unzip continues to use the same password as long as it appears to be valid, by testing a 12-byte header on each file. The correct password will always check out against the header, but there is a 1-in-256 chance that an incorrect password will as well. (This is a security feature of the PKWARE zipfile format; it helps prevent brute-force attacks that might otherwise gain a large speed advantage by testing only the header.) In the case that an incorrect password is given but it passes the header test anyway, either an incorrect CRC will be generated for the extracted data or else unzip will fail during the extraction because the «decrypted» bytes do not constitute a valid compressed data stream.

If the first password fails the header check on some file, unzip will prompt for another password, and so on until all files are extracted. If a password is not known, entering a null password (that is, just a carriage return or «Enter») is taken as a signal to skip all further prompting. Only unencrypted files in the archive(s) will thereafter be extracted. (In fact, that’s not quite true; older versions of zip and zipcloak allowed null passwords, so unzip checks each encrypted file to see if the null password works. This may result in «false positives» and extraction errors, as noted above.)

Archives encrypted with 8-bit passwords (for example, passwords with accented European characters) may not be portable across systems and/or other archivers. This problem stems from the use of multiple encoding methods for such characters, including Latin-1 (ISO 8859-1) and OEM code page 850. DOS PKZIP 2.04g uses the OEM code page; Windows PKZIP 2.50 uses Latin-1 (and is therefore incompatible with DOS PKZIP); Info-ZIP uses the OEM code page on DOS, OS/2 and Win3.x ports but ISO coding (Latin-1 etc.) everywhere else; and Nico Mak’s WinZip 6.x does not allow 8-bit passwords at all. unzip 5.3 (or newer) attempts to use the default character set first (e.g., Latin-1), followed by the alternate one (e.g., OEM code page) to test passwords. On EBCDIC systems, if both of these fail, EBCDIC encoding will be tested as a last resort. (EBCDIC is not tested on non-EBCDIC systems, because there are no known archivers that encrypt using EBCDIC encoding.) ISO character encodings other than Latin-1 are not supported. The new addition of (partially) Unicode (resp. UTF-8) support in UnZip 6.0 has not yet been adapted to the encryption password handling in unzip. On systems that use UTF-8 as native character encoding, unzip tries decryption with the native UTF-8 encoded password; the built-in attempts to check the password in translated encoding have not yet been adapted for UTF-8 support and will consequently fail.

ALZip

What We Like

  • Multilingual support.

  • Novel EGG format facilitates Unicode support.

What We Don’t Like

  • Consumes more system resources than WinZip.

  • EGG compression is painfully slow.

ALZip is a free archive compressor and extractor for Windows and Mac. It can extract files from 40 archive formats and create new archives in over five different formats.

AlZip supports scanning files right after they’re extracted using your own antivirus program, which is super helpful if you’re downloading lots of archives since they may contain malware.

In addition, ALZip supports drag and drop to open archives, and encryption when making a new one.

A really awesome feature we found in ALZip is the ability to preview the contents of an archive without opening it, called Peak in Archive. This works by simply right-clicking a supported archive (like a ZIP file) and viewing the file names in the context menu.

After installing AlZip, you must enter this free serial number to use it: EVZC-GBBD-Q3V3-DAD3.

Using the GUI to unzip files on Linux

The simplest approach is to use the GUI.
Below we show the steps involved when using the default desktop environment that comes with each linux distribution.
If you are using a custom setup, then these steps might not apply.
Use the if you are stuck!

Extract zip file with Ubuntu / Debian

  1. Open the Files app and navigate to the directory where zip file is located.
  2. Locate the file which you want to unzip.
  3. Right click on the file and the context menu will appear with list of options.
  4. Select “Extract Here” option to unzip files into the present working directory or choose “Extract to…” for a different directory.

Extract zip file with Mint

  1. Steps are same as above. Just note that an «Extract to…» option is not provided with the default installation.

That’s it, you have successfully unzipped the file. Optionally you could also use the Gnome Archive Mananger, which offers more advanced options and support for other file types.

unzip 6.0-14

Package Actions

  • Source Files /
    View Changes
  • Bug Reports /
    Add New Bug
  • Search Wiki
  • Security Issues
  • Flag Package Out-of-Date
    (?)
Architecture: x86_64
Repository: Extra
Description: For extracting and viewing files in .zip archives
Upstream URL: https://www.info-zip.org/UnZip.html
License(s): custom
Maintainers: Lukas Fleischer
Package Size: 139.4 KB
Installed Size: 315.1 KB
Last Packager: Jelle van der Waa
Build Date: 2020-04-24 13:00 UTC
Signed By: Jelle van der Waa
Signature Date: 2020-04-24 13:15 UTC
Last Updated: 2020-04-24 13:14 UTC

Required By (108)

  • bazel
  • bookworm
  • docx2txt
  • engrampa
  • file-roller
  • flatpak-builder
  • gnome-shell
  • java11-openjfx
  • java11-openjfx
    (testing)
  • java8-openjfx
  • java-openjfx
  • luarocks
  • lutris
  • opam
  • playonlinux
  • python-auditwheel
  • r
  • sugar-toolkit-gtk3
  • vym
  • winetricks
  • atool
    (optional)
  • audacious
    (optional)
  • diffoscope
    (optional)
  • doublecmd
    (optional)
  • krusader
    (optional)
  • lesspipe
    (optional)
  • nnn
    (optional)
  • recoll
    (optional)
  • unp
    (optional)
  • xarchiver
    (optional)
  • arduino
    (make)
  • arduino-builder
    (make)
  • argyllcms
    (make)
  • bluegriffon
    (make)
  • composer
    (make)
  • crypto++
    (make)
  • dbeaver-plugin-apache-poi
    (make)
  • dbeaver-plugin-batik
    (make)
  • dbeaver-plugin-bouncycastle
    (make)
  • dbeaver-plugin-office
    (make)
  • dbeaver-plugin-sshj
    (make)
  • dbeaver-plugin-sshj-lib
    (make)
  • dbeaver-plugin-svg-format
    (make)
  • docbook5-xml
    (make)
  • firefox
    (make)
  • firefox-developer-edition
    (make)
  • firefox-extension-https-everywhere
    (make)
  • firefox-extension-privacybadger
    (make)
  • firefox-noscript
    (make)
  • flyspray
    (make)
  • ghidra
    (make)
  • grails
    (make)
  • grammalecte
    (make)
  • gucharmap
    (make)
  • haskell-zip-archive
    (make)
  • hunspell-nl
    (make)
  • irrlicht
    (make)
  • java11-openjfx
    (make)
  • java11-openjfx
    (testing)
    (make)
  • java11-openjfx-doc
    (make)
  • java11-openjfx-doc
    (testing)
    (make)
  • java11-openjfx-src
    (make)
  • java11-openjfx-src
    (testing)
    (make)
  • java8-openjfx
    (make)
  • java-batik
    (make)
  • java-openjfx
    (make)
  • jdk11-openjdk
    (make)
  • jdk7-openjdk
    (make)
  • jdk8-openjdk
    (make)
  • jdk-openjdk
    (make)
  • jmol
    (make)
  • java11-openjdk
    (make)
  • java7-openjdk
    (make)
  • java8-openjdk
    (make)
  • java-openjdk
    (make)
  • jsmol
    (make)
  • languagetool
    (make)
  • libnoise
    (make)
  • libreoffice-fresh
    (make)
  • libreoffice-still
    (make)
  • libwebrtc
    (make)
  • mc
    (make)
  • mencoder
    (make)
  • mono-msbuild
    (make)
  • mplayer
    (make)
  • nltk-data
    (make)
  • java11-openjdk
    (make)
  • java7-openjdk
    (make)
  • java8-openjdk
    (make)
  • java-openjdk
    (make)
  • openra
    (make)
  • protobuf
    (make)
  • rabbitmq
    (make)
  • rocksndiamonds
    (make)
  • rocksndiamonds-data
    (make)
  • seamonkey
    (make)
  • simh
    (make)
  • swt
    (make)
  • thunderbird
    (make)
  • waf
    (make)
  • warzone2100
    (make)
  • xonotic
    (make)
  • xonotic-data
    (make)
  • diffoscope
    (check)
  • fontconfig
    (check)
  • lib32-fontconfig
    (check)
  • libgsf
    (check)
  • zziplib
    (check)

Final Thoughts

With this, we come to the end of the tutorial. Here we tried to describe every possible way on how to zip and unzip files on Ubuntu. The command-line utility is more useful when you are working with a remote server. The GUI format is simple and accessible for the right context menu to make the windows and macOS users more at home on Linux.

If you don’t want to install anything more to unzip files, you can also write Python or Perl scripts to do the job. We provided the scripts for that task. This is convincing while you are developing something that requires you to embed the unzipping functionality with the environment.

That’s all for the procedure of zipping and unzipping files and folders on Ubuntu. I hope the tutorial is sufficient for learning the whole thing. If I miss anything regarding the issue, please let me know in the comments. Happy Learning!

Examples

zipsplit -n 2097152 /home/user/myarchive.zip

Split the archive /home/user/myarchive.zip into multiple smaller archives, each of that is no larger than 2097152 bytes (2 megabytes). The split files will be written into the current directory.

zipsplit -p -n 2097152 /home/user/myarchive.zip

Same as the above command, but pause between the creation of each split file. This command can be useful on much older systems if the destination of your split files is a floppy disk drive, as it gives you the option to insert a new floppy disk between each split.

zipsplit -b /archive -n 2097152 myarchive.zip

Split myarchive.zip into zipfiles no larger than 2 megabytes, and write the split zipfiles into the directory /archive.

Examples

unzip hope.zip

Unzip the hope.zip archive into the current directory, creating subdirectories as needed to match the archive’s file hierarchy.

unzip -j hope.zip

Extract the files from archive hope.zip into the current directory only, regardless of the archive’s internal directory structure.

unzip -tq hope.zip

Test hope.zip for errors, but do not extract anything. The q indicates «quiet» mode, which instructs unzip to return only a summary message, rather than a more detailed one.

unzip -ca hope.zip *.txt

Display the contents of all files with the extension .txt contained in the archive hope.zip to the standard output.

unzip hope.zip "*." Makefile -d /tmp

Extract from the hope.zip archive any C source files with the extensions .c and .h, and any files named Makefile, into the directory /tmp.

unzip -C hope.zip "*." Makefile -d /tmp

Same as the above command, but case-insensitive; it will also extract any files with the extensions .C or .H, any files named MAKEFILE, any files named MakeFile, etc.

unzip -fo hope.zip

Extract files from the archive hope.zip, but only if they are newer versions than the files that already exist.

unzip -l hope.zip

Display a listing of the contents of hope.zip without extracting anything.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *