Inspecting Compressed Archive Contents Without Extraction in Linux

Viewing the contents of compressed archives without explicitly decompressing them first often relies on background temporary directories (typically /tmp), where contents are silently extracted for reading. After a system reboot, these temporary files are discarded.

Archives and compressed files differ slightly: archiving combines multiple files into one without size reduction, while compression merges and reduces file size. A compressed file can be an archive, but a plain archive is not necessarily compressed.

The following tools allow direct content inspection across various formats.

1. Vim

The Vim editor includes built-in support for browsing archives. Opening a compressed tarball displays its file list interactively:

vim backup.tar.gz
" tar.vim version v32
" Browsing tarfile /home/dev/backup.tar.gz
" Select a file with cursor and press ENTER
logs/
logs/server.log
config/
config/settings.yml
data.csv

Navigating with arrow keys and pressing Enter on a text file opens it directly inside Vim.

2. tar

The tar utility lists contents without writing files to the working directory.

Basic listing:

tar -tf project.tar
project/
project/src/
project/src/main.py
project/README.md
project/LICENSE

Detailed metadata:

tar -tvf project.tar
drwxr-xr-x dev/engineers 0 2023-10-14 09:22 project/
drwxr-xr-x dev/engineers 0 2023-10-14 09:22 project/src/
-rw-r--r-- dev/engineers 4521 2023-10-14 09:20 project/src/main.py
-rw-r--r-- dev/engineers 1083 2023-10-13 16:45 project/README.md
-rw-r--r-- dev/engineers  802 2023-10-13 16:45 project/LICENSE

3. rar

For RAR archives, the proprietary rar binary includes a view command:

rar v archive.rar
RAR 6.20 Copyright (c) 1993-2023 Alexander Roshal 24 Nov 2022
Trial version Type 'rar -?' for help
Archive: archive.rar
Details: RAR 5
Attributes Size Packed Ratio Date Time Checksum Name
----------- --------- -------- ----- ---------- ----- -------- ----
-rw-r--r--  1048576  891204  85% 2023-09-05 14:22 3A4F2C1B report.pdf
-rw-r--r--   262144  198732  76% 2023-09-06 08:15 7B8E9D2A dataset.csv
----------- --------- -------- ----- ---------- ----- -------- ----
  1310720  1089936  83%  2

4. unrar

The open-source unrar alternative lists contenst with the l switch:

unrar l archive.rar
UNRAR 6.20 freeware Copyright (c) 1993-2023 Alexander Roshal
Archive: archive.rar
Details: RAR 5
Attributes Size Date Time Name
----------- --------- ---------- ----- ----
-rw-r--r-- 1048576 2023-09-05 14:22 report.pdf
-rw-r--r--  262144 2023-09-06 08:15 dataset.csv
----------- --------- ---------- ----- ----
  1310720  2

5. zip

The zip tool itself can print archive manifests:

zip -sf bundle.zip
Archive contains:
images/
images/screenshot.png
docs/
docs/manual.txt
Total 2 entries (1240576 bytes)

6. unzip

The widely used unzip command provides table-style listings via -l:

unzip -l bundle.zip
Archive: bundle.zip
Length Date Time Name
--------- ---------- ----- ----
  1044480 2023-11-01 10:30 images/screenshot.png
   196608 2023-11-01 10:31 docs/manual.txt
--------- -------
  1241088 2 files

7. zipinfo

zipinfo delivers detailed technical metadata for ZIP files:

zipinfo bundle.zip
Archive: bundle.zip
Zip file size: 1192832 bytes, number of entries: 2
-rw-r--r-- 3.0 unx 1044480 bx defN 01-Nov-23 10:30 images/screenshot.png
-rw-r--r-- 3.0 unx  196608 tx defN 01-Nov-23 10:31 docs/manual.txt
2 files, 1241088 bytes uncompressed, 1189542 bytes compressed:  4.8%

8. zcat

To stream the uncompressed content of gzip-compressed files to standard output:

zcat logs.tar.gz

A equivalent invocation uses gunzip with the -c flag:

gunzip -c logs.tar.gz

9. zles

For paginated reading of compressed data, zless functions identically to less but operates on gzip archives:

zless logs.tar.gz

10. less

Modern less autodetects compression formats and renders archive contents interactively:

less logs.tar.gz

Tags: Linux CLI compression tar zip

Posted on Thu, 10 Sep 2026 16:26:39 +0000 by snaack