Add Check What Is Inside A Zip File as a Unix TIL

This commit is contained in:
jbranchaud
2026-08-22 09:04:49 -05:00
parent bcf957cabd
commit 453e9edbdf
2 changed files with 33 additions and 1 deletions
+2 -1
View File
@@ -10,7 +10,7 @@ working across different projects via [VisualMode](https://www.visualmode.dev/).
For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter).
_1870 TILs and counting..._
_1871 TILs and counting..._
See some of the other learning resources I work on:
@@ -1753,6 +1753,7 @@ If you've learned something here, support my efforts writing daily TILs by
- [Check SSH Key Fingerprints Of Known Hosts](unix/check-ssh-key-fingerprints-of-known-hosts.md)
- [Check The Current Working Directory](unix/check-the-current-working-directory.md)
- [Check The Installed OpenSSL Version](unix/check-the-installed-openssl-version.md)
- [Check What Is Inside A Zip File](unix/check-what-is-inside-a-zip-file.md)
- [Clear The Screen](unix/clear-the-screen.md)
- [Combine All My TILs Into A Single File](unix/combine-all-my-tils-into-a-single-file.md)
- [Command Line Length Limitations](unix/command-line-length-limitations.md)
+31
View File
@@ -0,0 +1,31 @@
# Check What Is Inside A Zip File
Before unzipping a file, it can be useful to check the contents. You can learn a
few things from doing this. First off, are all the files nested under some extra
top-level directory? How many files are in there? How big are certain files? Etc.
The `-l` flag to `unzip` can help answer these questions.
```bash
unzip -l zipped-files.zip
Archive: zipped-files.zip
Length Date Time Name
--------- ---------- ----- ----
0 08-22-2026 08:54 files-to-zip/
14 08-22-2026 08:54 files-to-zip/data.json
38 08-22-2026 08:53 files-to-zip/notes.md
14 08-22-2026 08:53 files-to-zip/hello.txt
--------- -------
66 4 files
```
Notice that the first line is for `files-to-zip/` which tells us that everything
is nested under the top-level directory that was probably the target of the
`zip` command. Everything is organized into a table with labeled columns which
allows us to answer our questions and get a good idea of what is in there.
In my experience, zip files tend to have dozens to hundreds of files, so it is
even better to pipe the above to a pager like `less`. That way you can search
and navigate through everything that's in there.
See `man unzip` for more details.