UNSQUASHFS(1)
UNSQUASHFS(1) Β· User Commands Β· UNSQUASHFS(1)
πΈ NAME πΈ
unsquashfs β bestie, this is the tool that uncompresses, extracts and lists squashfs filesystems. she does all three and she does them well π
π¦ SYNOPSIS π¦
unsquashfs [OPTIONS] FILESYSTEM [files to extract or exclude (with -excludes) or cat (with -cat )]
π DESCRIPTION π
okay so Squashfs is a highly compressed read-only filesystem for Linux. it uses either gzip/xz/lzo/lz4/zstd compression to compress both files, inodes and directories. and the inodes? teeny tiny. microscopic. adorable. and all blocks are packed to minimise data overhead. block sizes greater than 4K are supported up to a maximum of 1Mbytes (default block size 128K). yeah she can go big π«Ά
Squashfs is intended for general read-only filesystem use, for archival use (i.e. in cases where a .tar.gz file may be used), and in constrained block device/memory systems (e.g. embedded systems) where low overhead is needed. it's giving versatile, she fits in every situation no cap.
β¨ OPTIONS β¨
π Filesystem extraction (filtering) options π
-d PATHNAME,-dest PATHNAMEβ extract to PATHNAME, default"squashfs-root". and she's multitasking bestie: this option also sets the prefix used when listing the filesystem.-max LEVELS,-max-depth LEVELSβ descend at most LEVELS of directories when extracting. know your limits queen.-excludesβ treat files on command line as exclude files.-ex,-exclude-listβ list of files to be excluded, terminated with;e.g.file1 file2 ;.-extract-file FILEβ list of directories or files to extract. One per line.-exclude-file FILEβ list of directories or files to exclude. One per line.-matchβ abort if any extract file does not match on anything, and can not be resolved. Implies-missing-symlinksand-no-wildcards. she is not playing around here π-follow,-follow-symlinksβ follow symlinks in extract files, and add all files/symlinks needed to resolve extract file. Implies-no-wildcards.-missing,-missing-symlinksβ Unsquashfs will abort if any symlink can't be resolved in-follow-symlinks.-no-wild,-no-wildcardsβ do not use wildcard matching in extract and exclude names.-r,-regexβ treat extract names as POSIX regular expressions rather than use the default shell wildcard expansion (globbing).-all TIME,-all-time TIMEβ set all file timestamps to TIME, rather than the time stored in the filesystem inode. TIME can be an unsigned 32-bit int indicating seconds since the epoch (1970-01-01) or a string value which is passed to the"date"command to parse. any string value which the date command recognises can be used such as"now","last week", or"Wed Feb 15 21:02:39 GMT 2023". time travel but make it filesystem metadata β¨-catβ cat the files on the command line to stdout.-f,-forceβ if destination directory already exists, descend into it and any sub-directories, and unlink (delete) files if they already exist before extracting to them. no hesitation, no mercy.-pf FILEβ output a pseudo file equivalent of the input Squashfs filesystem, use-for stdout.
π Filesystem information and listing options π
-s,-statβ display filesystem superblock information.-max LEVELS,-max-depth LEVELSβ descend at most LEVELS of directories when listing.-i,-infoβ print files as they are extracted.-li,-linfoβ print files as they are extracted with file attributes (likels -loutput).-l,-lsβ list filesystem, but do not extract files.-ll,-llsβ list filesystem with file attributes (likels -loutput), but do not extract files.-lln,-llnumericβ same as-llsbut with numeric uids and gids.-lcβ list filesystem concisely, displaying only files and empty directories. Do not extract files.-llcβ list filesystem concisely with file attributes, displaying only files and empty directories. Do not extract files.-full,-full-precisionβ use full precision when displaying times including seconds. Use with-linfo,-lls,-llnand-llc. she's detail-oriented, we love her for it.-UTCβ use UTC rather than local time zone when displaying time.-mkfs-timeβ display filesystem superblock time, which is an unsigned 32-bit int representing the time in seconds since the epoch (1970-01-01).
π Filesystem extended attribute (xattrs) options π
-no,-no-xattrsβ do not extract xattrs in file system.-x,-xattrsβ extract xattrs in file system (default).-xattrs-exclude REGEXβ exclude any xattr names matching REGEX. REGEX is a POSIX regular expression, e.g.-xattrs-exclude '^user.'excludes xattrs from the user namespace.-xattrs-include REGEXβ include any xattr names matching REGEX. REGEX is a POSIX regular expression, e.g.-xattrs-include '^user.'includes xattrs from the user namespace.
π₯ Unsquashfs runtime options π₯
-v,-versionβ print version, licence and copyright information. the receipts, basically.-p NUMBER,-processors NUMBERβ use NUMBER processors. By default will use the number of processors available.-mem SIZEβ use SIZE physical memory for caches. UseK,MorGto specify Kbytes, Mbytes or Gbytes respectively. Default512 Mbytes.-mem-percent PERCENTβ use PERCENT physical memory for caches.-q,-quietβ no verbose output. shhh π€«-n,-no-progressβ do not display the progress bar.-percentageβ display a percentage rather than the full progress bar. Can be used withdialog --gaugeetc.-ig,-ignore-errorsβ treat errors writing files to output as non-fatal.-st,-strict-errorsβ treat all errors as fatal. no forgiveness mode.-no-exit,-no-exit-codeβ do not set exit code (to nonzero) on non-fatal errors.
π«Ά Help options π«Ά
-h,-helpβ print help summary information to pager (or stdout if not a terminal).-help-option REGEXβ print the help information for options matching REGEX to pager (or stdout if not a terminal).-help-section SECTIONβ print the help information for section SECTION to pager (or stdout if not a terminal). If SECTION does not exactly match a section name, it is treated as a regular expression, and all section names that match are displayed. Use"list"as section name to get a list of sections and their names.-help-allβ print help information for all Unsquashfs options and sections to pager (or stdout if not a terminal).-ho REGEXβ shorthand alternative to-help-option.-hs SECTIONβ shorthand alternative to-help-section.-haβ shorthand alternative to-help-all.-no-pagerβ do not use a pager to output help information.-cols WIDTHβ use WIDTH columns to output help information. Useful if output is not to a terminal.
πΈ Miscellaneous options πΈ
-o BYTES,-offset BYTESβ skip BYTES at start of FILESYSTEM. Optionally a suffix ofK,MorGcan be given to specify Kbytes, Mbytes or Gbytes respectively (default0 bytes).-fstimeβ synonym for-mkfs-time.-e,-ef EXTRACT FILEβ synonym for-extract-file.-exc,-excf EXCLUDE FILEβ synonym for-exclude-file.-Lβ synonym for-follow-symlinks.-pseudo-file FILEβ alternative name for-pf.
π EXIT STATUS π
0β The filesystem listed or extracted OK. clean run, we love to see it β¨1β FATAL errors occurred, e.g. filesystem corruption, I/O errors. Unsquashfs did not continue and aborted. she said "nope, I'm out" and meant it π2β Non-fatal errors occurred, e.g. no support for XATTRs, Symbolic links in output filesystem or couldn't write permissions to output filesystem. Unsquashfs continued and did not abort.
See-ignore-errors,-strict-errorsand-no-exit-codeoptions for how they affect the exit status.
π§ DECOMPRESSORS AVAILABLE π§
gzip, lzo, lz4, xz, zstd, lzma
π ENVIRONMENT π
SQFS_CMDLINEβ If set, this is used as the directory to write the filesqfs_cmdlinewhich contains the command line arguments given to Unsquashfs. Each command line argument is wrapped in quotes to ensure there is no ambiguity when arguments contain spaces. If the file already exists then the command line is appended to the file.PAGERβ If set, this is used as the name of the program used to display the help text. The value can be a simple command or a pathname. The default is/usr/bin/pager.
β¨ EXAMPLES β¨
okay bestie, this is the part where it all clicks. real commands, real vibes, copy-paste energy π
extract to the default spot
unsquashfs IMAGE.SQFS
Extracts IMAGE.SQFS into "squashfs-root" in the current working directory. that's the whole thing. it just does it β¨
extract somewhere specific
unsquashfs -d output IMAGE.SQFS
Extracts IMAGE.SQFS into "output" in the current working directory. name it whatever you want, it's your world π
extract literally right here
unsquashfs -d . IMAGE.SQFS
Extracts IMAGE.SQFS into the current working directory. <pink>yes the files are just gonna be there now, no folder holding them, be brave</pink> π
list AND extract at the same time
unsquashfs -linfo IMAGE.SQFS
Prints a listing of IMAGE.SQFS with file attributes to stdout, and also extracts the filesystem to "squashfs-root". multitasking icon behavior π
list with the squashfs-root prefix
unsquashfs -lls IMAGE.SQFS
Prints a listing of IMAGE.SQFS with file attributes to stdout, but does not extract the filesystem. the listing gets prefixed with "squashfs-root".
list without the prefix
unsquashfs -d "" -lls IMAGE.SQFS
Prints a listing of IMAGE.SQFS with file attributes to stdout, but does not extract the filesystem. and this time the listing is not prefixed with "squashfs-root". look at that empty -d "" doing the lords work π«Ά
just one directory, please
unsquashfs IMAGE.SQFS fs/squashfs
Extracts only the "fs/squashfs" directory. targeted. surgical. slay βοΈ
wildcard girlies rise
unsquashfs IMAGE.SQFS "[Tt]est/example*"
Extracts all files beginning with "example" inside top level directories called "Test" or "test". one pattern, two spellings, zero effort π
extract everything EXCEPT
unsquashfs -excludes IMAGE.SQFS "test/*data*.gz"
Extracts everything except files that match *data*.gz in the test directory. the -excludes option tells Unsquashfs to exclude the files on the command line rather than extract them. β¨
non-anchored exclude moment
unsquashfs -excludes IMAGE.SQFS "... *.gz"
Extracts everything except files that match *.gz anywhere in the image. the "..." means this is a non-anchored exclude, which matches anywhere. lowkey the most powerful three dots in the game π
extract AND exclude together
unsquashfs -ex "test/*data*.gz" ; IMAGE.SQFS test
This uses both extract and exclude options, telling Unsquashfs to only extract the "test" directory, and to exclude any files within it that match *data*.gz. both options, one command, main character energy π₯
the other extract+exclude combo
unsquashfs -ex "... *.gz" IMAGE.SQFS test
This uses both extract and exclude options, telling Unsquashfs to only extract the "test" directory, and to exclude files which match "*.gz" anywhere within the "test" directory or its sub-directories. π
depth limit unlocked
unsquashfs -dest output -max-depth 2 IMAGE.SQFS
Extracts only the top two levels of IMAGE.SQFS into the "output" directory. don't go deeper. we don't do that here π
depth limit + a path
unsquashfs -max-depth 2 IMAGE.SQFS "test/*.gz"
Only extracts the gzipped files in the test directory.
same but just list it
unsquashfs -llc -max-depth 2 IMAGE.SQFS "test/*.gz"
Prints a listing of the gzipped files in the test directory to stdout, but does not extract them. looking respectfully π
no xattrs, no problem
unsquashfs -no-xattrs IMAGE.SQFS
Does not extract any extended attributes. any extended attributes in the filesystem will simply be ignored. π§
xattrs, but only the user ones
unsquashfs -xattrs-include "^user." IMAGE.SQFS
Filters the extended attributes and only extracts extended attributes in the user namespace from the Squashfs filesystem. β¨
xattrs, but NOT the user ones
unsquashfs -xattrs-exclude "^user." IMAGE.SQFS
Filters the extended attributes and does not extract any extended attributes in the user namespace from the Squashfs filesystem. π
Note: when you pass wildcarded names to Unsquashfs, they should be quoted (like in all the examples above), so the shell doesn't get its hands on them first. your shell will try to expand them and it will not be cute. quote your patterns, bestie π
π AUTHOR π
Written by Phillip Lougher <phillip@squashfs.org.uk> π«Ά
π COPYRIGHT π
Copyright Β© 2026 Phillip Lougher <phillip@squashfs.org.uk>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. β¨
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. (fr fr, no warranty, read the license π)
π¦ SEE ALSO π¦
The README for the Squashfs-tools 4.7.5 release, describing the new features, can be read here:
https://github.com/plougher/squashfs-tools/blob/master/Documentation/4.7.5/README.md
The Unsquashfs usage guide can be read here:
https://github.com/plougher/squashfs-tools/blob/master/Documentation/4.7.5/USAGE-UNSQUASHFS.md
The CHANGELOG for Squashfs tools can be read here:
https://github.com/plougher/squashfs-tools/blob/master/CHANGES.md
and that's the whole page, bestie π this was unsquashfs version 4.7.5, dated March 2026, and it lives at UNSQUASHFS(1) in your manual pages. go forth and extract things. you're literally so good at this πβ¨π¦
π¦ where this page comes from
- arch rolling: squashfs-tools 4.7.5-1 Β· GPL-2.0-or-later
- ubuntu resolute: squashfs-tools 1:4.7.5-1 Β· GPL-2.0-or-later
- ubuntu stonking: squashfs-tools 1:4.7.5-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms