Linux unzip Command
-- Learning not only technology, but also dreams!
- Home
- HTML
- JavaScript
- CSS
- Vue
- React
- Python3
- Java
- C
- C++
- C#
- AI
- Go
- SQL
- Linux
- VS Code
- Bootstrap
- Git
- Local Bookmarks
Linux Tutorial
- Linux Tutorial
- Linux Introduction
- Linux Installation
- Linux Cloud Server
- WSL Install Linux
- Linux System Boot Process
- Linux System Directory Structure
- Linux Forgot Password Solution
- 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
Nginx Installation and Configuration
Deep Dive
- Computer Science
- Software
- Programming Languages
- Development Tools
- Web Design and Development
- Scripting
- Scripting Languages
- Web Services
- Network Services
- Programming
Linux unzip Command
The Linux unzip command is used to decompress .zip format compressed files.
The unzip tool can decompress .zip files containing multiple files and directories and is widely used for handling cross-platform compressed files.
Syntax
unzip file.zip
file.zip: The.zipfile to decompress.
Options parameters:
-d <directory>: Place decompressed files into the specified directory.-l: List the contents of the.zipfile without decompressing.-v: Display detailed information, including the structure and compression ratio of the.zipfile.-t: Test the integrity of the.zipfile without decompressing.-n: Do not overwrite existing files during decompression.-o: Overwrite existing files during decompression without prompting.-x <pattern>: Exclude specified files or directories during decompression.-j: Do not preserve directory structure during decompression; extract all files to the current directory.
Examples
Decompress a .zip file
unzip archive.zip
This command will decompress the contents of archive.zip into the current directory.
Decompress to a specified directory
unzip archive.zip -d /path/to/directory
This command will decompress the contents of archive.zip into the specified /path/to/directory directory.
List the contents of a .zip file
unzip -l archive.zip
This command will list all files and directories in archive.zip without actually decompressing them.
Test the integrity of a .zip file
unzip -t archive.zip
This command will test the integrity of the archive.zip file to ensure it is not corrupted.
Exclude specific files during decompression
unzip archive.zip -x "*.log"
This command will decompress archive.zip, but exclude all .log files.
Do not overwrite existing files during decompression
unzip -n archive.zip
This command will decompress the files from archive.zip, but if a file with the same name already exists in the target directory, it will skip that file and not overwrite it.
Decompress files and overwrite existing files
unzip -o archive.zip
This command will overwrite any existing files with the same name in the target directory during the decompression of archive.zip, without prompting the user.
Decompress without preserving directory structure
unzip -j archive.zip
This command will decompress all files from archive.zip into the current directory without preserving the original directory structure.
Notes
unzippreserves the original directory structure by default during decompression. If you do not need to preserve the directory structure, you can use the-joption.unzipcan exclude certain files or directories using the-xoption, which is useful for selectively decompressing specific files.
YouTip