Updated April 14, 2023
Introduction to Linux Unzip Zip File
In the Linux operating system, the zip command is used to archive compress the data. The zip utility is majorly used in the windows operating system. But we can use the same zip utility in the Linux platform also. Similarly, like zip utility, we are having the different utility to compress or zip the data like .tar, .tar.gz and tar.bz2, etc. Under the zip family, there are multiple utilities comes like zipdetails, zipsplit, zipcloak, zipinfo etc. The same packages are not available in all the Linux distribution. We need to install it manually but in the Ubuntu flavour like 18.04, 18.10, 19.04, 18.10. The packages are available. In this topic, we are going to learn about the Linux Unzip Zip File.
From 1997 to 2008, the copyright of the zip utility came under the Info-ZIP. But currently, the zip utility comes under the Info-ZIP license.
Syntax of the Linux Unzip Zip File
zip [ OPTIONS ] [ ADD ZIP FILE NAME ] [ LIST OF FILES ] unzip [ ZIP FILE NAME ]
- zip: We can use the “zip” keyword in the syntax or command. It will take different arguments like options; add the zip file name and the input file list to be compressed. As per the provided arguments, it will compress the input file list and create the “.zip” file.
- unzip: With the help of unzipping, we able to extract or unzip the zip file.
- OPTIONS: We can provide the different flags as the option that is compatible with the “zip” command.
- LIST OF FILES: As per the requirement, we can provide the file or file path to the zip command.
How does Linux Unzip Zip File work?
The zip and unzip utility both are available in the Linux environment. But it does not come with the minimal installation; we need to download or install the packages separately. While working with the zip utility, we need to take care few things like zipping or unzip command compatible options, the name of the zip file and the list of files or directories provided as input to it. As per the provided arguments, the zip commands will use the compression technique and compress the data into a single file, i.e. “.zip” format. The zip files are very useful in the email attachment. It is lightweight as per compare to the other normal data file.
Below are the lists of option that are compatible with the zip/unzip command.
|1||-a –ascii||The system is using EBCDIC. It will help to translate the file into ASCII format.|
|2||-A –adjust-sfx||It will help to adjust the self-extracting executable archive. The self-extracting executable archive will able to create by prepending the SFX stub to the existing archive. Note: The Amiga are a special case in the self-extracting archives.|
|3||–binary||The VM file or the CMS and MVS force file to be read the binary. The default format is the text.|
|4||–entry-comments||We are able to add the one-line comments for each file.|
|In the VMS, the preserved case all on VMS. The negative of the same option will be the (-C-) down cases.|
|In the VMS, the preserve case ODS2 on VMS. The negative of the same option will be the (-C-) down cases.|
|[In the VMS, the preserve case ODS5 on VMS. The negative of the same option will be the (-C-) down cases.|
|It will help to remove or delete the entries from a zip archive.|
|It will help to display the running byte counts showing the bytes zipped. The bytes to go.|
|It will help to display the uncompressed size of each entry.|
|It will help to print the volume number on the disk of each entry. It will be in the read-only format|
|12||-D –no-dir-entries||With the help of the same option, we are not creating the entries in the zip archive for directories. By default, the directory entries are created. So, we are able to save the attributes in the zip archive. We can use the environment variable like ZIPOPT. With the help of the same option, we are able to change the default options.|
Examples to Implement Linux Unzip Zip File
Here are the following examples mention below
1. Linux Zip Command: Zip Single File
In the Linux environment, we are able to create the zip file from a single input file also.
zip com.zip file1
As per the above command, we are zipping the single file, i.e. file1.
2. Linux Zip Command: Zip Multiple File
In the zip command, we can compress the file. Similarly, we are having the functionality to compress the multiple files in single zip command.
zip com.zip file1 file2 file3 file4 file5
As per the above command, we are having multiple files at the “/root/data” location. We are zipping the multiple files into the com.zip file.
3. Linux Zip Command: Add Extra File
We are having the functionality to add the extra file to the exiting zip file in the zip utility.
zip -u com.zip file6
We are adding the single file6 file into the com.zip file.
4. Linux Zip Command: Get Zip File Data/Content
In Linux, we are having the functionality to get the zip file content into it.
As per the above command, we can get the list of the file available in the com.zip file.
5. Linux Unzip Command: To Unzip Zip File
In Linux, we are having the functionality to get the unzip the file zip file.
As per the above command, we are unzipping the com.zip file.
We have seen the uncut concept of “Linux Unzip Zip File” with the proper example, explanation, and command with different outputs. As per the use, we can do the file or data compression with this utility. The compression ratio of text is high as compare to the video file.
We hope that this EDUCBA information on “Linux Unzip Zip File” was beneficial to you. You can view EDUCBA’s recommended articles for more information.