l (List contents of archive) command
Lists contents of archive.
Examples
7z l archive.zip
lists all files from archive archive.zip .
Notes
7-Zip doesn't use the system wildcard parser. 7-Zip doesn't
follow the archaic rule by which *.* means any file. 7-Zip treats
*.* as matching the name of any file that has an extension. To process
all files, you must use a * wildcard.
Switches that can be used with this command
-ai (Include archives)
-an (Disable parsing of archive_name)
-ax (Exclude archives)
-i (Include)
-slt (Show technical information)
-sns (Store NTFS alternate Streams)
-p (Set Password)
-r (Recurse)
-stx (Exclude archive type)
-t (Type of archive)
-x (Exclude)
Notes from this site
Not part of the 7-Zip manual. Written by this site; examples checked with 7-Zip 26.04.
Quick examples
On Linux and macOS the official console binary is 7zz; the commands differ from Windows only by that name.
7zz l archive.7z # table of files
7zz l -slt archive.7z # per file: Path, Size, Packed Size, Modified, CRC, Method
7zz l archive.7z -r '*.doc' # only .doc files, in any folder
7zz l archive.7z docs # only the folder docs and what is in it
7zz l -ba -pSECRET archive.7z # encrypted file names (SECRET shows in the process list)
7zz l -tzip file.bin # force the format when the name has no known extension
7zz l '*.7z' # list every matching archive
7zz l x.tar.gz # shows only the inner x.tar; extract it, then list the .tar
Use -t when the format is not detected; run 7zz i to see the supported formats. Details are on the -slt and -t pages. -ba (bare output: no header or footer) works in 7-Zip 26.04 but has no page in this manual. It also works on the plain table: 7zz l -ba archive.7z prints only the file rows.
How do I parse the listing in a script?
Use -slt with -ba. Without -ba the first Path = line is the archive itself. With it, you get one key = value block per entry, separated by blank lines, and folders are included (Attributes = D).
One entry in -slt output (folders have an empty CRC):
Path = f/a.txt
Size = 6
Packed Size = 17
Modified = 2026-10-13 23:54:22.5337363
Attributes = A -rw-r--r--
CRC = 363A3020
Encrypted = -
Method = LZMA2:12
Block = 0
7zz l -slt -ba archive.7z | awk '/^Path = /{sub(/^Path = /,"");print}' # names, spaces kept
7zz l -slt -ba archive.7z | sed -n 's/^Size = //p' # sizes only
Reading the output
In a solid .7z archive the Compressed column is filled only for the first file of a block; the others share one stream.
Common mistakes
Filtering without -r: 7zz l archive.7z '*.doc' printed nothing for files in subfolders. Add -r .
Leaving out -p when file names are encrypted (7z -mhe=on): 7-Zip prompts, and without a terminal it fails. Archives that encrypt only contents list without a password.
Quote wildcards on Linux and macOS so the shell does not expand them first.
A damaged or missing archive prints an error and the exit code is 2, also with -ba; check it in scripts (exit codes ).
Related pages