
funzip Command in Linux
The Linux funzip command lets you view the first non-directory member in an archive without extracting it. It is a useful tool to view the contents of an archive file when extracting the entire archive is not desirable. It can be used to inspect whether the archive file is malicious or not.
The funzip command supports both .zip and .gz archives
Syntax of funzip Command
The syntax of the Linux funzip command is as follows −
funzip [-password] [file [.zip|.gz]]
The arguments of the funzip command are listed below −
Arguments | Description |
---|---|
[-password] | It is used to specify the password of a password-protected archive |
[file [.zip|.gz]] | It is used to specify the archive file; .zip or .gz |
Usage of funzip Command
This section demonstrates the usage of the Linux funzip command with examples −
1. Viewing the Contents of the First Member of an Archive with One Member
To view the first member of an archive, use the funzip command with the file name.
funzip archive.zip

Similarly, for .gz file, use the following command −
funzip archive.gz

2. Viewing the Contents of the First Member of an Archive with Multiple Members
An archive file can have multiple files. To list the contents of a zip archive, use the command given below −
unzip -l archive.zip

The above command output shows that the archive contains more than one file.
The funzip command only views the content of the first member of the archive and skips the remaining with a warning −
funzip archive.zip

3. Viewing the Contents of the First Member of an Archive with a Password
If the archive file is password-protected, the password can be specified with the dash (-). However, it is not a secure way to access the archive.
funzip -abc123 archive.zip

In the above command, abc123 is the password.
4. Viewing the Contents of the First Member of an Archive by Piping the Output
The funzip command output can be piped to the more and less commands. These commands are used to display large output with easier navigation. The more command presents the output one screen at a time, while the less command is easier to navigate with directional keys.
funzip archive.zip | more

The output of the less command can be obtained using the command given below −
funzip archive.zip | less

5. Saving the Contents of the First Member of an Archive
To save the contents of the first member of an archive file, use the redirection operator (>).
funzip archive.zip > file

The archive has more than one file. The warning will be shown to the standard output while the content will be saved in the file as shown in the output image.
6. Displaying funzip Command Help and Version
To display command, help, and version, execute the funzip command without any option −
funzip
Conclusion
The funzip command in Linux is used to view the contents of the first non-directory member of an archive instead of extracting the whole file. It is also called a filter for extracting from an archive in a pipe. It can be used to inspect the archive before extracting it.
In this tutorial, we explained the funzip command, its syntax, arguments, and usage in Linux through various examples.