User Tools

Site Tools


unix_commands:zip

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.zip file.txt
  2. Compress multiple files: zip archive.zip file1.txt file2.txt file3.txt
  3. Compress a directory: zip -r archive.zip directory/
  4. Compress files and directories with a specific extension: zip -r archive.zip directory/ -i '*.html'
  5. Compress a directory and use maximum compression: zip -r -9 archive.zip directory/
  6. to update an existing archive by using the -u option, for example: zip -u archive.zip 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 archive.zip
  2. Extract files and directories to a specific directory: unzip archive.zip -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 archive.zip 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!