How to Unzip/Zip Files in Linux/Unix using command line?

Want to know how to unzip/Zip the file in Linux from command line?

Unzip/Zip are the extraction and compress tool which is easily available in Unix based OS like Mac OS, Windows, Linux Redhat etc.

Try zip and unzip command in Terminal

If you get following command not found then you need to install the package using

zip: command not found or
unzip: command not found

Linux Debian / Ubuntu

apt-get install zip
apt-get install unzip

Redhat, Fedora, Centos

yum install zip
yum install unzip

How to Zip only one File? i.e Single file

zip techtach.zip techtach.mp3

It will zip techtach.mp3 and name the file as techtach.zip

How to Zip Multiple files or folder?

zip file.zip file1.txt file2.mp3 file3.pdf

It will zip all three files and name the file as file.zip

zip xyz.zip file1.txt folder1 folder2

It will zip 2 folders and one file in xyz.zip

How to extract zip file using command line?

unzip xyz.zip

It will unzip xyz.zip in the current directory.

 

Pinterest
Email
Print