- How To Unzip Files On Linux
- Quick Tip!
- Using the GUI to unzip files on Linux
- Extract zip file with Ubuntu / Debian
- Extract zip file with Mint
- Other Linux unzip applications
- Extract zip file with Archive Manager
- Extract zip file with Ark
- How to unzip on Linux using terminal
- Install unzip on Linux
- Unzip on the Linux command line
- Unzip files on command line with unarchiver
- Install unarchiver
- Unarchive files
- Unzip tar.gz files on command line
- Unzip 7z files on command line
- Unzip zipx files on command line
- How to Create and Extract Zip Files to Specific Directory in Linux
- Create Zip Archive File in Linux
- Extract Zip File to Specific or Different Directory
- If You Appreciate What We Do Here On TecMint, You Should Consider:
- How To Extract Zip, Gz, Tar, Bz2, 7z, Xz and Rar File in Linux
- Extract .zip file in Linux
- Extract .gz file in Linux
- Extract .tar file in Linux
- Extract .tar.gz file in Linux
- Extract .tar.xz file in Linux
- Extract .tar.bz2 file in Linux
- Extract .7z file in Linux
- Extract .rar file in Linux
- Как распаковать ZIP в Linux
- Распаковка ZIP Linux
- Как распаковать ZIP Linux с помощью 7z
- Выводы
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
- Open the Files app and navigate to the directory where zip file is located.
- Locate the file which you want to unzip.
- Right click on the file and the context menu will appear with list of options.
- 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
- 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.
- Open the Files app and navigate to the directory where zip file is located.
- Right click the file and select «Open With Archive Manager».
- 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.
Extract zip file with Ark
Ark is another archive manager that ships as a default in a lot of distributions.
- Open Ark. It will initially say «No archive loaded»
- Select «Open. » from the top Archive menu
- It will open the contents of the zip file into Ark. Select «Extract All > Extract To» from the Archive menu
Extract To»>
- 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.
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.
Источник
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.
Источник
Как распаковать ZIP в Linux
В операционной системе Windows формат архивов ZIP считается чуть ли не стандартным, он даже поддерживается в этой операционной системе, что называется «из коробки». Если вы только перешли с Windows, то у вас, наверное, есть много таких архивов с различными файлами, также ZIP-архивы могут часто попадаться на просторах интернета. Поэтому работать с такими файлами в Linux вам однозначно придётся.
В этой небольшой статье мы рассмотрим, как распаковать ZIP Linux. Разберём несколько способов и воспользуемся несколькими утилитами, которые справятся с этой задачей.
Распаковка ZIP Linux
Формат ZIP был создан в 1989 году на замену очень медленному формату ARC. Здесь используется сжатие deflate, и на то время оно работало намного быстрее чем ARC. Исторически сложилось так, что стандартным форматом для Linux стали TAR и GZ — это усовершенствованные алгоритмы сжатия и архивации. Многие графические распаковки воспринимают и ZIP-файлы. Но они обрабатывают архивы не сами, а дают команду предназначенным для этого формата утилитам.
Утилита для распаковки ZIP называется unzip, она не всегда установлена по умолчанию. Но вы можете очень просто добавить её в свою систему из официальных репозиториев. Для этого в Ubuntu выполните:
sudo apt install unzip
А в системах, использующих формат пакетов Red Hat, команда будет выглядеть немного по-другому:
sudo yum install unzip zip
После установки большинство графических утилит для работы с архивами смогут распаковать архив ZIP Linux. Команда ZIP Linux установлена на случай, если вы захотите создавать ZIP-архивы.
Но этой утилите не нужны дополнительные оболочки для распаковки архива. Вы можете сделать всё прямо из консоли. Давайте рассмотрим синтаксис утилиты:
$ unzip опции файл_архива.zip файлы -x исключить -d папка
- файл архива — это тот файл, с которым нам предстоит работать;
- файлы — здесь вы можете указать файлы, которые нужно извлечь, разделять имена файлов пробелом;
- исключить — файлы, которые извлекать не нужно;
- папка — папка, в которую будет распакован архив.
Теперь рассмотрим опции утилиты, поскольку она позволяет не только распаковывать архивы, но и выполнять с ними определённые действия:
- -l — вывести список файлов в архиве;
- -t — протестировать файл архива на ошибки;
- -u — обновить существующие файлы на диске;
- -z — вывести комментарий к архиву;
- -c — извлекать файлы на стандартный вывод, перед каждым файлом будет выводиться его имя;
- -p — то же самое, только имя выводится не будет;
- -f — извлечь только те файлы, которые уже существуют на диске, и файлы в архиве более новые;
- -v — вывести всю доступную информацию;
- -P — указать пароль для расшифровки архива;
- -n — не перезаписывать существующие файлы;
- -j — игнорировать структуру архива и распаковать всё в текущую папку;
- -q — выводить минимум информации.
Все самые основные опции рассмотрели, теперь давайте рассмотрим несколько примеров работы с программой в терминале. Чтобы распаковать ZIP Linux в текущую папку, достаточно набрать:
Причём расширение указывать не обязательно. Протестировать архив можно с помощью опции -t:
unzip -tq имя_файла.zip
Вы можете протестировать все архивы в текущей папке, выполнив:
Если нужно распаковывать архив не в текущую папку, можно очень просто указать нужную:
unzip имя_файла.zip -d /tmp
Также можно распаковывать не весь архив, а только нужные файлы или файлы нужного формата:
unzip имя_файла.zip \*.txt -d /tmp
С помощью опции -l вы можете посмотреть список файлов в архиве:
unzip -l file.zip
Утилиту unzip разобрали и теперь вы с ней точно справитесь. Но я говорил, что мы рассмотрим несколько способов, как выполняется распаковка ZIP Linux. Поэтому дальше мы поговорим об утилите 7z.
Демонстрация работы утилит zip и unzip в терминале:
Как распаковать ZIP Linux с помощью 7z
7z — это кроссплатформенный набор утилит для работы с архивами. Кроме собственного формата, здесь поддерживается большое количество других, в том числе tar и zip. Плюс этой утилиты — в контекстное меню файлового менеджера будет добавлен пункт, с помощью которого вы сможете распаковывать или создавать архивы.
Для установки утилиты в Ubuntu или Debian выполните:
sudo apt install p7zip-full
А в Red Hat и CentOS:
sudo yum install p7zip
Теперь вы можете использовать контекстное меню вашего файлового менеджера, чтобы распаковать архив ZIP Linux. Также можно использовать программу в консоли. Синтаксис очень похож на unzip:
$ 7z команда опции имя_архива
Команда задаёт нужное действие. Нас будут интересовать только четыре команды:
- e (Extract) — извлечь файлы из архива;
- x eXtract — извлечь файлы из архива, сохраняя полный путь;
- l (List) — список файлов архива;
- t (Test) — проверить архив.
Теперь рассмотрим самые полезные опции:
- -o — указать папку для распаковки;
- -p — указать пароль;
- -x — не извлекать эти файлы;
- -w — указать рабочую директорию;
- -y — отвечать положительно на все вопросы;
Ну и рассмотрим примеры работы с утилитой. Сначала проверим содержимое архива:
Распаковываем архив, сохраняя структуру подкаталогов:
Или распаковываем все файлы в одну папку, игнорируя подкаталоги:
Или вы можете указать папку, в которую нужно распаковать файлы с помощью опции -o:
7z x файл.zip -o /tmp/
Выводы
В этой статье была рассмотрена распаковка ZIP Linux, как видите, это ненамного сложнее, чем распаковка стандартных архивов TAR. Мы рассмотрели два способа ,и теперь вы точно будете знать, что делать, когда столкнетесь с такой ситуацией. Если у вас остались вопросы, спрашивайте в комментариях!
Источник