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.zip myfile.txtTo create a zip archive of several files:
$ zip myfiles.zip file1.txt photo.jpg script.jsTo zip up a whole directory named downloads:
$ zip -r downloads.zip downloadsTo create a zip archive of files and directories:
$ zip -r myfiles.zip file1.txt photo.jpg script.js downloadsTo check if a zipped archive is fine or not:
$ unzip -tq downloads.zipTo unzip a zip archive:
$ unzip downloads.zipTo see the contents of a zip archive:
$ unzip -l downloads.zipTo extract a file from a zip archive:
$ unzip downloads.zip photo23.jpgTo unarchive a zip archive to a specific location:
$ unzip downloads.zip new_downloadsExercise
- When is the tar command used?
- What are the alternatives to zip and unzip commands?