Code Snippets

How to Unzip files in Linux

If you are trying to answer these questions, you in the right article.

How to unzip a file from the Terminal?
How to Unzip Files in Linux?

To install unzip we will run:

Data compression without data loss is achieved using the ZIP extension. In a ZIP file, the user can compress more than one directory and compressed files. Therefore, users must use a command-line tool or utility to extract these ZIP files. All types of ZIP files can be opened using the unzip command on a Linux system.

sudo apt-get install unzip

With this command we will install it if it is not installed already.

Unzip the file to the same directory

If the source and destination directories are the same, you can simply do:

unzip testfile.zip

Unzip the file to another directory

if you want to extract to a particular destination folder, you can use:

unzip yourfile.zip -d folder_name

Using -d switch with unzip command, you can extract the file to a different location instead of the current directory.

Overwrite the existing unzipped files

If you have already unzipped file and you will again run the command as follows:

unzip testfile.zip

In this case, it will ask you to overwrite the existing unzipped file which is displayed in the following output:

In this article, you learned the uses of unzip command that is very helpful to list and extract the ZIP archives. I hope this article would be useful for you in the future.

Dmitry Pierce

I am passionate about understanding consumer behavior, identifying market trends, and creatively communicating the unique value of products or services to potential customers. I am driven by a desire to positively impact people's lives by helping businesses succeed.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button