Extracting zip files in Linux is essential for accessing compressed files and directories. Zip archives are commonly used to bundle multiple files into a single compressed file, and extracting these archives allows users to access the original files. This process is straightforward and can be done using the terminal.
The unzip utility is commonly used to extract zip files in most Linux distributions. This tool efficiently unpacks the contents of a .zip archive into the specified directory. The unzip command ensures compatibility with zip archives created on other operating systems like Windows or macOS.
Once extracted, the files and directories will appear in their original structure. The steps below demonstrate how to extract a zip file in Linux using simple commands.
Steps to extract zip files in Linux:
- Open the terminal.
- Navigate to the directory containing the .zip file.
$ cd /path/to/directory/
- Use the unzip command followed by the .zip file name to extract it.
$ unzip output_filename.zip Archive: output_filename.zip inflating: file1.txt inflating: folder1/file2.txt
Replace output_filename.zip with the name of the .zip file you want to extract.
- Optionally, specify a different directory to extract the contents of the .zip file.
$ unzip output_filename.zip -d /path/to/extract/ Archive: output_filename.zip inflating: /path/to/extract/file1.txt inflating: /path/to/extract/folder1/file2.txt
Replace output_filename.zip with the name of the .zip file, and path/to/extract with the target directory where you want to extract the files.
- Verify that the extraction was successful by listing the contents of the directory.
$ ls -lh /path/to/extract/ total 4.0K -rw-r--r-- 1 user user 1.2K Sep 14 12:00 file1.txt drwxr-xr-x 2 user user 4.0K Sep 14 12:00 folder1
You should see the extracted files and directories listed here.
Mohd Shakir Zakaria is an experienced cloud architect with a strong development and open-source advocacy background. He boasts multiple certifications in AWS, Red Hat, VMware, ITIL, and Linux, underscoring his expertise in cloud architecture and system administration.
Comment anonymously. Login not required.