Linux zip extract file

Содержание
  1. How To Unzip Files On Linux
  2. Quick Tip!
  3. Using the GUI to unzip files on Linux
  4. Extract zip file with Ubuntu / Debian
  5. Extract zip file with Mint
  6. Other Linux unzip applications
  7. Extract zip file with Archive Manager
  8. Extract zip file with Ark
  9. How to unzip on Linux using terminal
  10. Install unzip on Linux
  11. Unzip on the Linux command line
  12. Unzip files on command line with unarchiver
  13. Install unarchiver
  14. Unarchive files
  15. Unzip tar.gz files on command line
  16. Unzip 7z files on command line
  17. Unzip zipx files on command line
  18. How to Create and Extract Zip Files to Specific Directory in Linux
  19. Create Zip Archive File in Linux
  20. Extract Zip File to Specific or Different Directory
  21. If You Appreciate What We Do Here On TecMint, You Should Consider:
  22. Как распаковать Zip-архив в Linux
  23. How to Unzip Files in Linux
  24. В этом руководстве мы объясним, как разархивировать файлы в системах Linux через командную строку с помощью unzip команды.
  25. Установка unzip
  26. Установить unzip на Ubuntu и Debian
  27. Установить unzip на CentOS и Fedora
  28. Как распаковать ZIP файл
  29. Подавить вывод unzip команды
  30. Распакуйте ZIP-файл в другой каталог
  31. Распакуйте ZIP-файл, защищенный паролем
  32. Исключить файлы при распаковке ZIP-файла
  33. Перезаписать существующие файлы
  34. Распакуйте ZIP-файл без перезаписи существующих файлов
  35. Распакуйте несколько ZIP-файлов
  36. Перечислите содержимое файла Zip
  37. Вывод
  38. How To Extract Zip, Gz, Tar, Bz2, 7z, Xz and Rar File in Linux
  39. Extract .zip file in Linux
  40. Extract .gz file in Linux
  41. Extract .tar file in Linux
  42. Extract .tar.gz file in Linux
  43. Extract .tar.xz file in Linux
  44. Extract .tar.bz2 file in Linux
  45. Extract .7z file in Linux
  46. Extract .rar file in Linux

How To Unzip Files On Linux

So you’ve been sent a .zip file as an attachment and now you’re stuck figuring how to extract it’s content? Or some such! Luckily you’ve stumbled upon the right place, as at ezyZip we eat zip files for breakfast! Linux offers various solutions to uncompressing zip files, depending on your configuration and variant.

Below we outline some common methods to unzipping files on the Linux environment.

Quick Tip!

Looking to quickly open zip archive without hassle? Use ezyZip! 😊
It runs in the browser, so no need to install any extra software. Just navigate to the unzip page and follow the given instructions. It’s FREE!

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 command line unzip options 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.

Other Linux unzip applications

There is a myriad of dedicated archive management applications that can be utilised for unzipping files. Some are packaged with the distribution and others can be installed separately.

Extract zip file with Archive Manager

Archive Manager comes as a default installation with many Linux distros and is quick & easy way to decompress archives.

  1. Open the Files app and navigate to the directory where zip file is located.
  2. Right click the file and select «Open With Archive Manager».
  3. Archive Manager will open and display the contents of the zip file. Click «Extract» on the menu bar to uncompress the contents into the current directory.
Читайте также:  Visual studio code для linux manjaro

Extract zip file with Ark

Ark is another archive manager that ships as a default in a lot of distributions.

  1. Open Ark. It will initially say «No archive loaded»
  2. Select «Open. » from the top Archive menu
  3. It will open the contents of the zip file into Ark. Select «Extract All > Extract To» from the Archive menu
    Extract To»>
  4. Select the directory you wish to extract the files to and then click «Extract»

How to unzip on Linux using terminal

If you want to work like a pro and desire more powerful features, you have to move towards command line interface. Fire up your terminal and run one of the following commands to complete your desired task. The examples assume you have a filename called backup.zip.

Install unzip on Linux

If unzip command is not installed on your system, then you’ll need to do that first.
sudo apt install unzip

Unzip on the Linux command line

The simplest option that will extract the contents to current directory:
unzip backup.zip

To change the target directory for extracted material, use -d option followed by the desired directory:
unzip backup.zip -d ./restore-directory

To preview contents of zip file:
unzip -l backup.zip

If you don’t want to unzip the whole file, then add the specific files to extract at the end:
unzip backup.zip file1 subdirectory/file2

The inverse of the above command. Unzip every file EXCEPT the ones specified after the -x modifier:
unzip backup.zip -x file1 subdirectory/file2

Unzipping a password protected file:
unzip -p mypassword backup.zip

Unzip files on command line with unarchiver

A great free set of unarchiving command line utilities are supplied by the Unarchiver. There is a GUI too but that is currently only offered to MacOS users.

The best part about these utilities is that they support dozens of other file formats (e.g. rar, 7z, arj etc. ) and the command line syntax is the same for all of them.

Install unarchiver

Unarchive files

To uncompress a file:
unar backup.zip

Uncompress file to a different directory:
unar -o ./output-directory backup.zip

Check out all the other parameters available with:
unar -h

Unzip tar.gz files on command line

Linux and other unix variants commonly use tar and gz to package collection of files into a single package (e.g. software packages). To use the GUI for opening tar.gz files, follow the zip file instructions above. The command line options however are slightly different:

First uncompress the gz file:
gunzip filename.tar.gz

The output of the above should be filename.tar. Now to extract the tar file contents:
tar xvf filename.tar

You can combine the above two commands by adding a «z» option:
tar zxvf filename.tar.gz

Alternately, you could use ezyZip to extract tar.gz files or open tar file individually.

Unzip 7z files on command line

Another compression format that you will often encounter is 7z.

Install p7zip (if needed)
sudo apt-get install p7zip-full

To extract a 7z archive:
7z e backup.7z

Unzip zipx files on command line

The zipx file format is commonly associated with WinZip and not available for linux users. However fear not, you can use the 7zip utility to open zipx files in linux!

Install p7zip (if needed)
sudo apt-get install p7zip-full

Источник

How to Create and Extract Zip Files to Specific Directory in Linux

In one of our several articles about the tar command, we showed you how to extract tar files to a specific or different directory in Linux. This short guide explains to you how to extract/unzip .zip archive files to a specific or different directory in Linux.

Zip is a simple, cross-platform file packaging and compression utility for Unix-like systems including Linux and Windows OS; plus many other operating systems. The “zip” format is a common archiving file format used on Windows PC’s and most importantly, it enables you to specify the compression level between 1 and 9 as an option.

Create Zip Archive File in Linux

To create a .zip (packaged and compressed) file from the command line, you can run a similar command like the one below, The -r flag enables recursive reading of files directory structure.

Читайте также:  Максимальный объем оперативной памяти для windows server

Create Zip File in Linux

To unzip the tecmint_files.zip archive file you have just created above, you can run the unzip command as follows.

The above command will extract the files into the current working directory. What if you want to send the unzipped files into a specific or different directory – you can learn this in the next section.

Extract Zip File to Specific or Different Directory

To extract/unzip .zip archive files to specific or different directory from the command line, include the -d unzip command flag as shown below. We will use the same example above to demonstrate this.

This will extract the .zip file content into the /tmp directory:

Extract Zip Files to Specific Directory

For more usage information, read zip and unzip command man pages.

You may also like to read the following related articles.

In this short article, we have explained how to extract/unzip .zip archive files to a specific or different directory in Linux. You can add your thoughts to this article via the feedback form below.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

We are thankful for your never ending support.

Источник

Как распаковать Zip-архив в Linux

How to Unzip Files in Linux

В этом руководстве мы объясним, как разархивировать файлы в системах Linux через командную строку с помощью unzip команды.

ZIP является наиболее широко используемым форматом архивных файлов, который поддерживает сжатие данных без потерь. ZIP-файл — это контейнер данных, содержащий один или несколько сжатых файлов или каталогов.

Установка unzip

unzip не устанавливается по умолчанию в большинстве дистрибутивов Linux, но вы можете легко установить его, используя менеджер пакетов вашего дистрибутива.

Установить unzip на Ubuntu и Debian

Установить unzip на CentOS и Fedora

Как распаковать ZIP файл

В простейшем случае unzip команда без каких-либо параметров извлекает все файлы из указанного ZIP-архива в текущий каталог.

В качестве примера, скажем, вы загрузили установочный ZIP-файл WordPress . Чтобы разархивировать этот файл в текущий каталог, вам нужно просто выполнить следующую команду:

ZIP-файлы не поддерживают информацию о владельце в стиле Linux. Извлеченные файлы принадлежат пользователю, который запускает команду.

У вас должны быть права на запись в каталог, в который вы распаковываете ZIP-архив.

Подавить вывод unzip команды

По умолчанию unzip печатает имена всех извлекаемых файлов и сводные данные, когда извлечение завершено.

Используйте -q переключатель, чтобы подавить печать этих сообщений.

Распакуйте ZIP-файл в другой каталог

Чтобы разархивировать ZIP-файл в каталог, отличный от текущего, используйте -d переключатель:

Например, чтобы разархивировать архив WordPress latest.zip в /var/www/ каталог, вы должны использовать следующую команду:

В приведенной выше команде мы используем, sudo потому что обычно пользователь, в который мы вошли, не имеет разрешения на запись в /var/www каталог. Когда файлы ZIP распаковываются с использованием sudo , извлеченные файлы и каталоги принадлежат пользователю root.

Распакуйте ZIP-файл, защищенный паролем

Чтобы разархивировать файл, защищенный паролем, вызовите unzip команду с -P параметром, за которым следует пароль:

Ввод пароля в командной строке небезопасен и его следует избегать. Более безопасным вариантом является обычное извлечение файла без указания пароля. Если файл ZIP зашифрован, unzip вам будет предложено ввести пароль:

unzip будет использовать один и тот же пароль для всех зашифрованных файлов, если он правильный.

Исключить файлы при распаковке ZIP-файла

Чтобы исключить извлечение определенных файлов или каталогов, используйте -x параметр, за которым следует разделенный пробелами список архивных файлов, которые вы хотите исключить из извлечения:

В следующем примере мы извлекаем все файлы и каталоги из архива ZIP, кроме .git каталога:

Читайте также:  Восстанавливаем загрузку windows 10

Перезаписать существующие файлы

Допустим, вы уже распаковали ZIP-файл и снова запускаете ту же команду:

По умолчанию unzip вас спросят, хотите ли вы перезаписать только текущий файл, перезаписать все файлы, пропустить извлечение текущего файла, пропустить извлечение всех файлов или переименовать текущий файл.

Если вы хотите перезаписать существующие файлы без запроса, используйте -o параметр:

Используйте эту опцию с осторожностью. Если вы внесли какие-либо изменения в файлы, изменения будут потеряны.

Распакуйте ZIP-файл без перезаписи существующих файлов

Допустим, вы уже распаковали ZIP-файл и внесли изменения в некоторые файлы, но случайно удалили несколько файлов. Вы хотите сохранить изменения и восстановить удаленные файлы из архива ZIP.

В этом случае используйте -n параметр, который заставляет unzip пропустить извлечение файла, который уже существует:

Распакуйте несколько ZIP-файлов

Вы можете использовать регулярные выражения для сопоставления нескольких архивов.

Например, если у вас есть несколько ZIP-файлов в вашем текущем рабочем каталоге, вы можете разархивировать все файлы, используя только одну команду:

Обратите внимание на одинарные кавычки *.zip . Если вы забыли процитировать аргумент, оболочка расширит символ подстановки, и вы получите ошибку.

Перечислите содержимое файла Zip

Чтобы просмотреть содержимое файла ZIP, используйте -l параметр:

В приведенном ниже примере мы перечисляем все установочные файлы WordPress:

Вывод будет выглядеть так:

Вывод

unzip это утилита, которая помогает вам составлять список, тестировать и извлекать сжатые ZIP-архивы.

Чтобы создать ZIP-архив в системе Linux, вам нужно использовать команду zip .

В этом руководстве мы объясним, как разархивировать файлы в системах Linux через командную строку с помощью unzip команды.

Источник

How To Extract Zip, Gz, Tar, Bz2, 7z, Xz and Rar File in Linux

An archive file is a file composed of one or more files in compressed format. It’s useful for saving disk storage, managing a single file is easier than managing multiple files. This tutorial will help you to decompress or extract an archive file in the Linux system via command line. You can also list archive file content without extracting it.

Extract .zip file in Linux

This is the most common compression format used by various IT professions on many operating systems. For this you must of unzip binary installed on your system.

Extract .gz file in Linux

Gz files are compressed files created using the Gzip compression utility. In general, GZIP is better compared to ZIP, in terms of compression, especially when compressing a huge number of files. Use gunzip command to extract .gz archive file.

Extract .tar file in Linux

Tar is the sort of Tape Archive and also referred to as the tarball. This is another popular archiving method which is also known as the consolidated Unix archive format. To extract .tar file use following command

Extract .tar.gz file in Linux

TAR.GZ file is a combination of TAR and GZIP archives. If provides more compression format of data. You can use -z switch to extract these files.

Extract .tar.xz file in Linux

The XZ format is a single file compression format and does not offer archiving capabilities. It preserves the original data with no loss in quality. You can use -J switch to extract these files.

Extract .tar.bz2 file in Linux

Tar.bz2 is an combination of tar and bzip2 archive formats. You can use -j to filter the archive through bzip2. Use the following to extract .tar.bz2 compressed file.

The latest version fo tar automatically detects the archive format. So you can simply use the following command.

Extract .7z file in Linux

These files are 7zip archive files. This is not generally used on Linux systems, but sometimes you may need to extract some source files. You must have the 7zip package installed on your system. Use the following command to extract these files.

Extract .rar file in Linux

These are common archive format for Windows systems, but Linux users avoid to use this. Still you may need sometimes to extract .rar file on Linux. You can use 7z command to extract this or unrar.

Источник

Оцените статью