How to Zip and Unzip Files In Linux

Hey, guys if you are looking for a method to zip and unzip files in Linux. Then check how quickly you can do this with few simple commands.  There are several methods for compressing and retrieving data in Linux operating system. I recommend you to use the “zip” function to compress your data files because of its ease of use and portability. Today all the major operating system supports the zip compression technique.

 

how to zip unzip file in linux

 

Now let’s check out the various unzip methods we can use in Linux operating system. The most unzip method depends on the extension of the compressed file. The most common extension of the compressed file is:- .zip, .tar, .gz, etc.

Zipping Files Using ZIP Compression

Zip (file formatZIP is a file compression format that supports lossless data compression. A ZIP file may contain one or more data files or directories that may have been compressed. The ZIP file format permits multiple compression algorithms, though DEFLATE Algorithm is most commonly used. The Linux zip program is compatible with all the major operating system. You can unzip the files compressed by Linux in any other operating system.

The command for Zipping Files in Linux

The syntax for Zipping the Files
zip [options] zipfile files_list

example for  Creating a zip file:
$zip myfile.zip filename.txt

 

Unzipping Zip Files

If you have an archive named File1.zip and want to get back the files, you would type:

Unzip the archive
Unzip File1.zip

List the data in the zip file
Unzip -l File1.zip

Unzip the archive in the specified path
unzip File1.zip -d /my/awesome/path

 

Unzipping Tar Files

To extract a file compressed with tar extension type the following in Linux command line:
tar xvf filename.tar

 

Unzipping Gunzip Files

To retrieve a file compressed with gunzip compression, type the following:
Gunzip filename_tar.gz

Then if you receive no errors, type:
tar xvf filename_tar

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.