How to zip and unzip files in Linux#

To create ".zip" files in Linux, you use the zip command. To unzip ".zip" files, you use the unzip command.

Here are some common uses of the zip and unzip commands in Linux.

To zip a single file:

$ zip myfile.txt

To create a zip archive of several files:

$ zip file1.txt photo.jpg script.js

To zip up a whole directory named downloads:

$ zip -r downloads

To create a zip archive of files and directories:

$ zip -r file1.txt photo.jpg script.js downloads

To check if a zipped archive is fine or not:

$ unzip -tq

To unzip a zip archive:

$ unzip

To see the contents of a zip archive:

$ unzip -l

To extract a file from a zip archive:

$ unzip photo23.jpg

To unarchive a zip archive to a specific location:

$ unzip new_downloads


  • When is the tar command used?
  • What are the alternatives to zip and unzip commands?


Tweet this | Share on LinkedIn |