zip

If you want to extract a tar file, use the tar tool[3].

Zipping a file or folder

$ zip [options] output.zip inpath[ inpath ...]

inpath can also accept a glob pattern, like ./*.

Option Arguments Description
-r Travel the directory structure recursively. For use if input is a folder
-@ none but really stdin Each line of stdin is a file to be added to the archive. e.g. find . -name "*.[ch]" -print[1]
-e Encrypts the archive and prompts the user for the password securely
-P password password: The password for the archive Encrypts the archive with the given password

Unzipping a file

$ unzip [options] archive.zip
Option Arguments Description
-d dir dir: folder for extracted contents Extract contents of archive to dir

References

  1. https://linux.die.net/man/1/zip
  2. https://linux.die.net/man/1/unzip
  3. tar(1): manual page for tar 1.23 - Linux man page

Last modified: 202401040446