User Tools

Site Tools


The zip command in Linux and Unix-like systems is used to compress and archive files and directories. It creates a zip archive file with the .zip file extension. The zip command is the counterpart of the unzip command.

Here are a few examples of how the zip command can be used:

  1. Compress a single file: zip file.txt
  2. Compress multiple files: zip file1.txt file2.txt file3.txt
  3. Compress a directory: zip -r directory/
  4. Compress files and directories with a specific extension: zip -r directory/ -i '*.html'
  5. Compress a directory and use maximum compression: zip -r -9 directory/
  6. to update an existing archive by using the -u option, for example: zip -u file.txt

To extract files, you'd need to use the unzip command. Here are a few examples:

  1. Extract files from a zip archive: unzip
  2. Extract files and directories to a specific directory: unzip -d /path/to/directory

zip command is widely used to backup, transfer, and share files and directories. It can also be used to compress large files to save disk space. The unzip command can be used to extract the files from a zip archive. You can also use the -r option to include all subdirectories and files recursively. The -i option can be used to include files with a specific pattern or extension.

It's also possible to password protect your archive by using -e option, for example:

zip -e directory/

this will prompt you to enter a password to encrypt the archive.

unix_commands/zip.txt ยท Last modified: 2023/01/17 08:43 by admin

CIFNet is a leading hosting solution provider, offering a wide range of services including IP bandwidth, co-location, VMware and KVM hosting.
Host Your Site with CIFNet!