YouTip LogoYouTip

Linux Comm Zip

Linux zip Command body { font-family: Arial, sans-serif; line-height: 1.6; max-width: 1200px; margin: 0 auto; padding: 20px; color: #333; } h1, h2, h3 { color: #2c3e50; } code { background-color: #f4f4f4; padding: 2px 5px; border-radius: 3px; font-family: monospace; } pre { background-color: #f8f8f8; padding: 15px; border-left: 4px solid #3498db; overflow-x: auto; } .menu-item { margin-right: 15px; text-decoration: none; color: #3498db; } .note { background-color: #fff3cd; border-left: 4px solid #ffc107; padding: 10px; margin: 10px 0; } .example { margin: 15px 0; padding: 10px; background-color: #e8f4fd; border-radius: 5px; }

Linux zip Command

- What we learn is not only technology, but also dreams!

Home HTML CSS JS Local Bookmarks Search
Vue3 Tutorial Vue2 Tutorial
Bootstrap3 Bootstrap4 Bootstrap5
Machine Learning PyTorch TensorFlow Sklearn NLP AI Agent Ollama Coding Plan

Linux Tutorial

Linux Tutorial Linux Introduction Linux Installation Linux Cloud Server WSL Install Linux Linux System Boot Process Linux System Directory Structure Linux Forgotten Password Solutions Linux Remote Login Linux File Basic Attributes Linux File and Directory Management Linux User and User Group Management Linux Disk Management Linux vi/vim Linux yum Command Linux apt Command

Shell Tutorial

Shell Tutorial Shell Variables Shell Passing Arguments Shell Arrays Shell Operators Shell echo Command Shell printf Command Shell test Command Shell Process Control Shell Functions Shell Input/Output Redirection Shell File Inclusion

Linux Reference Manual

Linux Command Manual Nginx Installation and Configuration MySQL Installation and Configuration Linux Quiz
Shell File Inclusion Nginx Installation and Configuration

Deep Exploration

  • Network Services
  • Programming
  • Computer Science
  • Development Tools
  • Software
  • Web Design and Development
  • Programming Languages
  • Scripting
  • Web Service
  • Scripting Languages

Linux zip Command

Linux Command Manual Linux Command Manual

The Linux zip command is used to compress files.

zip is a widely used compression program, and the compressed file has the extension .zip.

Unlike gzip or bzip2, zip can compress multiple files or entire directories while preserving the directory structure.

zip is also widely supported across platforms (such as Windows, macOS).

Syntax

zip  output.zip file1 file2 ...
  • output.zip: The name of the generated compressed file.
  • file1 file2 ...: Files or directories to compress.

Options parameters:

  • -r: Recursively compress directories and all files in subdirectories.
  • -e: Set password protection for the compressed file.
  • -q: Quiet mode, does not display compression process.
  • -v: Display detailed compression process.
  • -x: Exclude certain files or directories from compression.
  • -m: Delete original files after compression.
  • -0 to -9: Specify compression level, -0 means store without compression, -9 means highest compression ratio, default is -6.

Examples

Compress a single file

zip archive.zip example.txt

This command will compress example.txt into archive.zip.

Compress multiple files

zip archive.zip file1.txt file2.txt file3.txt

This command will compress file1.txt, file2.txt, and file3.txt into archive.zip.

Recursively compress directories

zip -r archive.zip directory/

This command will recursively compress all files in the directory/ directory and its subdirectories while preserving the directory structure.

Compress with password protection

zip -e archive.zip file.txt

This command will compress file.txt with password protection. A password will be required during decompression.

Exclude specific files

zip -r archive.zip directory/ -x "*.log"

This command will compress all files in the directory/ directory but exclude all .log files.

Delete original files after compression

zip -m archive.zip file.txt

This command will compress file.txt into archive.zip and delete the original file file.txt.

Decompress files

Use the unzip command to decompress .zip files:

unzip archive.zip

This will decompress the archive.zip file to the current directory, preserving the original directory structure and files.

Linux Command Manual Linux Command Manual

← Os MknodOs Mkfifo β†’