Technology

#How to View the Contents of ZIP or TAR Files Without Extracting in Linux

“How to View the Contents of ZIP or TAR Files Without Extracting in Linux”

Bash Shell

Working with archives is a common task in Linux, but sometimes, you may not know what the contents of the archive look like. If you want to take a peek at the inside of a ZIP or TAR file without extracting it, there are tools that can help you.

Using unzip to View ZIP Files

To view inside ZIP files, you’ll need the unzip utility, which might not be included by default. You can install it from your system’s package manager if it isn’t:

sudo apt install zip unzip

This utility is used to extract ZIP files, but with the lowercase -l flag, it will list the contents instead:

unzip -l file

If you want just a raw list of all the files in the archive, you can use zipinfo with the -1 flag to only print filenames:

zipinfo -1 file

This can be useful for bash scripts, or when piped to other commands like less, which can help you search through a large archive. You can also pipe it to a text utility like grep or sed to find matches for certain files:

zipinfo -1 file | grep string

RELATED: How to Use the less Command on Linux

Using tar to View tarballs

TAR archives, also known as tarballs, are another kind of archive format used commonly in Linux. You can also print the contents of these without extracting them, by using the -t flag

tar -tf filename.tar.gz

Like zipinfo, this prints a raw list of all the files, and can be piped to other utilities for processing.

If you liked the article, do not forget to share it with your friends. Follow us on Google News too, click on the star and choose us from your favorites.

For forums sites go to Forum.BuradaBiliyorum.Com

If you want to read more like this article, you can visit our Technology category.

Source

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button
Close

Please allow ads on our site

Please consider supporting us by disabling your ad blocker!