A ZIP archive is a compressed file containing different files that can be sent through email to another user. Users can visualize the content of ZIP files by extracting them from the ZIP Archive in the command line.
This article will explain different methods to display the contents of the ZIP archive in Linux.
- Using the zmore Command
- Using the zcat Command
- Using Vim Editor
- Using the 7z Archiver
- Using the zip and unzip Commands
Method 1: Using the zmore Command
The “zmore” command is pre-installed in the Linux systems. Users can view all the contents of the ZIP archive in Linux:
$ zmore myZip1.zip
The output shows that the content “itslinuxfoss” is present in the “myZip1.zip” displayed in the terminal.
Method 2: Using the zcat Command
Similar to the “zmore” command, the “zcat” command can view the Zip file’s contents. But this works on the single zip file only:
$ zcat myZip1.zip
The output shows the content of the “myZip1.zip” in the terminal.
Method 3: Using Vim Editor
Vim is a modern text editor with multiple features and tools. To install the vim editor in Linux, execute the below script:
$ sudo apt install vim # Ubuntu, Debian, and LinuxMint $ sudo yum install vim # CentOS $ sudo dnf install vim # Fedora
After the installation of the above script, the vim editor is used to view the contents of the ZIP archive by specifying the name of file “myZip.zip”:
$ vim myZip.zip
Users can visualize the content of the ZIP archive in the text editor.
Method 4: Using the 7z Archiver
The 7z is another Linux tool used to manage the zip file. To install the “7z Archiver” in the Linux distributions, execute the below script:
$ sudo apt install p7zip-full # Ubuntu, Debian, and LinuxMint $ sudo yum install p7zip # CentOS $ sudo dnf install p7zip # Fedora
To display the contents of the ZIP archive, utilize the “7z” command by specifying the zip file as “myZip.zip” in the below script:
$ 7z l myZip.zip
The output unzips the archive file and displays the content of several files.
Method 5: Using the zip and unzip Commands
The last but most important one is the zip and unzip commands. These are used for managing the compressed archives. To use the zip command to view the zip archive’s contents, use the sf options:
$ zip -sf myZip.zip
Moreover, with the unzip command, you can see the contents of the zipped files as well with the c option:
$ unzip -c myZip.zip
These all methods are used to view the contents of the ZIP archive in Linux.
To view the contents of the ZIP archive in Linux, “zmore”, “zcat”, “zip, and unzip”, “Vim editors”, and “7z Archiver” are utilized. All these tools have a variety of usages to serve, which are explained in this post with examples..