How to unzip files in Linux?Generally, almost all files like documents, media files are shared in the zip format to avoid several types of damages or theft. One can also set the password to protect the files from unnecessary access, which also helps protect the documents' confidentiality. Still, new users or that are not familiar enough with computers or do not have an IT background face many difficulties while working with these types of files, such as opening the zip files, compressing files, etc. In this tutorial, we will learn how to open the zip files in Linux based operating systems (Ubuntu). Before going further, we need to know how to identify the zip files first. If the downloaded files (or target file) contain .tar.gz or .zip in extension, it means that the file is a type of zip file. To access the contents of a zip file, we need to extract that file, after which we can easily access the content of that file. The ZIP extension is one of the most used file formats that's utilized for data compression without loss of data. The user can compress multiple compressed files and directories in the ZIP file. So, users require to extract the ZIP files with a few command-line utilities or tools. Users can deal with every type of ZIP file easily with the unzip command in the Linux system. Prerequisite:
Usage of unzip
Options of unzipNote: The usage screen is restricted to 22 or 23 lines and, therefore, should be taken only as a reminder of the common unzip syntax instead of an exhaustive list of every possible flag to support old hardware.The exhaustive list pursues:
Modifiers of unzip
How to install Unzip utility in the Ubuntu?To unzip a zip archive file, you must have the unzip package installed in your system. However, almost all modern Linux distributions come with unzip support, but there is no harm in verifying it to avoid nasty surprises later in case of you are not sure about it. In Ubuntu and Debian based distributions, one can use the following given steps to install unzip. If it's already installed on your operating system, it will notify you about it. Step 1: Open the terminal and types the following given command and press enter as shown in the given output: Command : Output Once you install the unzip package in your operating system, now you can zip and unzip the files as per requirements. There are two ways available through which zipped files can be unzipped in the Linux operating system; here, we will discuss both the methods (or processes), along with practical. Let's understand the above methods in details. Unzip files using the Linux terminalThe following steps will help us to work with zipped files in Linux and show how to zip files without reducing their quality. Steps to Unzip files in Linux: Step 1 - The process of unzipping files in Linux is very straightforward. First of all, open the terminal and go to the directory, where we have our zip file as shown in the given image: Step 2 - Now use the "ls "command to view all files stored in that directory and use the following command to unzip the zip file. Let's understand the working of this command by following example: Suppose we have a zipped file such as "samplefile.zip" stored in our download directory. To unzip the "simplefile.zip," we need to open the terminal and go to the download directory using the following commands: Example Step 2 - Now type the command <unzip "samplefile.zip"> and press enter, and once the file gets unzipped, you can access the content of your unzipped file as shown in the given image: How Zip files in Linux? The process of converting your standard files into zipped format is slightly different than what we have done earlier. To convert a file (e.g., samplefile.mpg), we have to go to the directory where the file is stored in your operating system. Once you reach the directory, you can use the following command to convert that file into the zipped format. Command: To see how this command works, consider the following given example: We can also provide the zip file path we want to unzip instead of going to the directory. To do that, consider the following given steps: Step 1. Open the terminal and type the following given command Command: It will show the following output. In general, this command seems very handy to use. However, in some cases, the user may face a slightly bigger problem while using the above command if he does not use it carefully. The main problem with this command is that it usually extracts all the contents of that particular zip file in the current directory or folder, which is not good, at least in some cases. Unzip files to the DirectoryThe above problem can be avoided easily by unzipping the target file to an individual directory instead of extracting it into the current directory. This way, our all extracted files will be stored in the specified directory. In some situations where the directory specified by the user does not exist, it will also take care of that by creating the directory with the mentioned label. Let see how to unzip a file to a particular directory To unzip a zipped file to a particular folder or directory, one can use the following instructions: Step1: Open the terminal and go the directory where your compressed or zipped file is stored. Once you reach that directory, type the following given command in the terminal Command : To understand how this command works, consider the following given example: Suppose you have a zipped file (e.g., samplefile.zip ) that you want to extract in a particular different directory (e.g., Akash).To do that, you need to specify the directory or address of the directory in which you want to extract your zipped file. Hence our command will be looks like the following ones: Command <unzip samplefile.zip -d \Akash> Output Now all the content of the samplefile.zip will be extracted to the user's specified directory. 2. Unzip files via the Graphic User Interface:This method is absolutely simple for all users, even for beginners. It just looks like that of the window's process of extracting zip files. To unzip the zip files via the graphic user interface, follow the instructions given below. Step 1. Open the file explorer in your Linux operating system: Step 2. Now go to that folder, where you stored zipfile (e.g., textfile.zip) and select it, as shown below: Step 3. After selecting the zipped file, click the mouse's right button to view more options: Step 2. Now click on the option "Extract Here" or "Extract to" as per requirements. We want to extract that file in the current folder, then click on the "Extract" option. Step 4. In case you want to extract that file in a different folder, then you can use the "Extract to" option as shown below: Step.5 After clicking on the "Extract to" option, a new window will be opened in which you have to specify any directory where you want to store the content of the file. Once you select the directory or folder, click on the Select option as shown below: Step5. Now we move to the selected folder or directory to verify that file is unzipped. Next Topicchroot Command |