Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save montgomerykern/697db5c84d09125714b97a7888697d8b to your computer and use it in GitHub Desktop.
Save montgomerykern/697db5c84d09125714b97a7888697d8b to your computer and use it in GitHub Desktop.
Linux Zip Commands Cheat Sheet
ziping files/directories examples
Creates the archive data.zip and puts all the files in the current directory in it in compressed form, type:
$ zip data *
Note: No need to add .zip extension or suffix as it is added automatically by zip command.
Use the ls command to verify new zip file:
$ ls
To zip up an entire directory (including all subdirectories), type the following command:
$ zip -r data *
unziping files/directories examples
To use unzip to extract all files of the archive pics.zip into the current directory & subdirectories:
$ unzip pics.zip
You can also test pics.zip, printing only a summary message indicating whether the archive is OK or not:
$ unzip -tq pics.zip
To extract the file called cv.doc from pics.zip:
$ unzip pics.zip cv.doc
To extract all files into the /tmp directory:
$ unzip pics.zip -d /tmp
To list all files from pics.zip:
$ unzip -l pics.zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment