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-symlinks and -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 (like ls -l output).
  • -l, -ls β€” list filesystem, but do not extract files.
  • -ll, -lls β€” list filesystem with file attributes (like ls -l output), but do not extract files.
  • -lln, -llnumeric β€” same as -lls but 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, -lln and -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. Use K, M or G to specify Kbytes, Mbytes or Gbytes respectively. Default 512 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 with dialog --gauge etc.
  • -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 of K, M or G can be given to specify Kbytes, Mbytes or Gbytes respectively (default 0 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-errors and -no-exit-code options 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 file sqfs_cmdline which 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 Β© 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