Home>Article>Operation and Maintenance> What is the command to decompress zip in linux
The Linux command to decompress zip is unzip. The specific method of using this command is: first install unzip through "sudo apt install unzip"; then decompress it through the "unzip zipped_file.zip" command.
#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.
How to decompress zip files under Linux system
Zip in Linux system is a common way to create compressed archive files, and it is also a traditional file archive File format, this format was created in 1989. Due to its widespread use, users will often encounter zip files. In this article, the editor will introduce how to decompress zip files under Linux system.
In order to unzip a zip archive, the unzip package must first be installed on the Linux system. Most Linux distributions provide support for unzipping zip files, but it never hurts to verify those zip files to avoid corruption later.
On Unbutu and Debian based distributions, you can use the following command to install unzip:
sudo apt install unzip
If the Linux system is already installed, you will be informed that it has been installed. Once unzip is installed on a confirmed system, you can unzip the zip archive. You can also use the command line or graphical tools to achieve the goal. The following is an introduction to the operation methods.
1. Use the command line to decompress the file
It is very simple to use the unzip command under the Linux system. Directly in the directory where the zip file is placed, use the following operation command:
unzip zipped_file.zip
You can provide the decompression path for the zip file instead of decompressing it to the current path. You will see the extracted files in the terminal output:
1)unzip metallic-container.zip -d my_zip 2)Archive: metallic-container.zip 3)inflating: my_zip/625993-PNZP34-678.jpg 4)inflating: my_zip/License free.txt 5)inflating: my_zip/License premium.txt
There is a small problem with the above command. It will extract all the contents of the zip file to the current folder, and then leave a bunch of unorganized files in the current folder, which is not a very ideal operation.
[Recommended learning:linux video tutorial]
2. Unzip to a folder
In the command line of the Linux system, for the file Extracting to a folder is a good idea because this way all extracted files will be stored in the specified folder, or created if the folder does not exist.
For example:unzip zipped_file.zip -d unzipped_directory
, then all the contents in zipped_file.zip will be extracted tounzipped_directory
.
What we want to pursue is convenient operation, so there is a point to note here, that is, we can view the contents of the compressed file without actually decompressing it.
3. View the contents of the compressed file without decompressing the compressed file
Operation command:unzip -l zipped_file.zip
4. Use graphics Interface to decompress files
If the user is using a desktop Linux system, it is not necessary to always use the terminal. In the graphical interface, another operation method can be used.
Open the file manager and jump to the folder where the zip file is located. Right-click on the file and you will see the option [Extract here] in the pop-up window, click to select.
Different from the unzip command, this extraction option will create a folder with the same name as the compressed file and store all the contents of the compressed file in the created folder. Compared to the default behavior of the unzip command, Extract the compressed file to the current file, and the operation of the graphical interface is very simple.
Note that there is also an option [Extract to...], which allows you to select a specific folder to store the extracted files.
The above is the detailed content of What is the command to decompress zip in linux. For more information, please follow other related articles on the PHP Chinese website!