leonardoaguiar.com inspector
Langue

inspector

A magnifying glass for the disk, in the terminal. inspector looks at a folder, a file or anything else and says everything there is to know about it. Every folder is measured to the bottom, the way du does, with many folders read at the same time, and the same measure can be looked at as a list, a tree, a map, by kind of file, by age, by size or by the biggest files. One file gets a card: what it is by its bytes, its sizes, every date, flags, attributes and, on request, its hash. Any view but the map comes out as JSON too.

Install

macOS, with Homebrew, two commands, once:

brew tap leonardoaguiar/inspector https://leonardoaguiar.com/apps/inspector/tap.git
brew install leonardoaguiar/inspector/inspector

brew upgrade brings new versions, and so does inspector --update.

Linux (any distribution, x86_64 or ARM), Android inside Termux, and Windows inside WSL:

curl -fsSL https://leonardoaguiar.com/apps/inspector/install.sh | sh

It picks the build for the machine, checks its published SHA-256 and installs the binary, the man page and the shell completions in /usr/local (asking for sudo when needed), ~/.local or Termux's own folder. Running it again updates; sh -s -- --uninstall removes it.

Use

CommandWhat it shows
inspectorWhat is in the current folder, as a list
inspector ~/DownloadsWhat is in Downloads
inspector movie.mp4Everything about one file: the card
inspector *.mp4Only these files, as a list
inspector -T ~/LibraryThe library as a tree, two levels down
inspector -m ~A map of the home folder
inspector -y ~/MoviesWhat kinds of files take the space
inspector -g ~/Library/CachesHow old the files are
inspector -z .How big the files are
inspector -L 50 /ApplicationsThe 50 biggest files anywhere inside
inspector -i a b cThe card of each of these
inspector -j -y . \| jq .kindsAny view as JSON

With one folder, inspector looks at what is in it; with one file, at the file itself; with several paths, at those paths. Hidden files are always included. The views -T, -m, -y, -g, -z, -L and -i take the place of the list, one at a time; -j turns any of them but the map into JSON.

The list

The default view, from the smallest to the biggest, so the biggest ends up right above the prompt.

MODE         OWNER  GROUP  MODIFIED          FILES  FOLDERS  DATA  DISK      %              NAME
-rw-r--r--   leo    staff  2026-10-28 16:33                  5.7K  8.0K  <0.1%  ▏           notes.txt
-rw-r--r--@  leo    staff  2026-10-12 09:41                   11M   12M   0.6%  ▏           photo.heic  hidden
drwxr-xr-x   leo    staff  2026-10-28 16:58  1,204       87  1.1G  1.2G  58.1%  ██████████  Projects/  mostly code, largest 310M app/build/app.zip
drwxr-xr-x@  leo    staff  2026-10-20 18:02    213       14  780M  820M  41.3%  ███████    Movies/  mostly video
                                             1,419      103  1.9G  2.0G         total, 4 items: 1,419 files, 103 folders, measured in 84ms
                                                                                241G free of 926G on /System/Volumes/Data (apfs), 74.0% used
ColumnWhat it shows
MODEType and permissions, as ls -l writes them, with @ when the item has extended attributes
OWNER, GROUPWho owns the item
MODIFIEDThe last change; for a folder, the newest change of anything inside it, all the way down
FILES, FOLDERSFor a folder, how many files and folders are inside it, all the way down
DATAThe bytes in the files, what ls -l shows for a file
DISKThe space the item takes on disk, what du shows; this is the size that sorts, in bold
%The item's share of the total
The barThe item against the biggest in the list
NAMEFolders bold blue with a trailing /, symbolic links cyan with -> and the target, executables green

The tree

-T shows the items and, under each folder, the first levels of what is inside it: two by default, -d 3 for three, and so on. The columns are the files inside, DATA, DISK, the share of the total and a bar against the biggest item, so a folder's weight can be followed down to where it comes from.

FILES   DATA   DISK      %              NAME
    3  1002K  1008K   1.3%  ▎           Documents/
        5.6K   8.0K  <0.1%  ▏           ├── notes.txt
        137K   140K   0.2%  ▏           ├── budget.xlsx
        859K   860K   1.1%  ▏           └── report.pdf
    9    14M    14M  17.8%  ██▉         Projects/
    3    69K    72K  <0.1%  ▏           ├── site/
        6.8K   8.0K  <0.1%  ▏           │   ├── style.css
         12K    12K  <0.1%  ▏           │   ├── index.html
         50K    52K  <0.1%  ▏           │   └── app.js
    6    13M    13M  17.7%  ██▉         └── app/
        103K   112K   0.1%  ▏               ├── 2 smaller items
    2    13M    13M  17.6%  ██▉             └── build/
    2    47M    47M  62.2%  ██████████  Movies/
         18M    18M  23.2%  ███▊        ├── birthday.mov
         30M    30M  38.9%  ██████▎     └── trip.mp4
   20    76M    76M                     total, 5 items: 20 files, 9 folders

In each folder, the children under 1% of it are folded into one line, N smaller items; --min 5% or --min 1M changes the limit, and a single small item is shown rather than folded. The same sort options apply (-r, -n, -t, -c), at every level.

The map

-m draws the items as a map: every item is a rectangle whose area is its share of the total, the biggest at the top left, each with its name and size. In colour the rectangles are filled with the colour of their size, the same gradient as the bars; without colour they are boxes. The items too small for a box of their own share one shaded block, and the line below says how many they are. The map takes half the height of the terminal (80 by 20 in a pipe) and is the one view that has no JSON: it is drawn, not written.

┌────────────────────────────────────────────────┐┌─────────────┐┌────────────┐░
│Movies/                                         ││Photos/      ││Projects/   │░
│47M                                             ││14M          ││14M         │░
│                                                ││             ││            │░
│                                                ││             ││            │░
└────────────────────────────────────────────────┘└─────────────┘└────────────┘░
76M in 5 items; 2 smaller items share the shaded block (1.0M)

By kind, by age, by size

Three tables of the same shape: the files that fall in each row, their DATA and DISK, their share of the total and a bar against the biggest row.

-y says what kinds of files take the space, by category (images, video, audio, documents, code, data, archives, disk images, programs, fonts, other) and then by extension, the fifteen biggest. The kind of a file comes from its name here: no file is opened.

FILES   DATA   DISK      %              KIND
    5    14M    14M  18.7%  ███         images
    2    47M    47M  62.2%  ██████████  video
    5  1010K  1020K   1.3%  ▎           documents
    6   168K   180K   0.2%  ▏           code
    1   4.0M   4.0M   5.3%  ▉           archives
    1   9.3M   9.3M  12.3%  ██          other
   20    76M    76M                     total, 6 kinds

FILES  DATA  DISK      %              EXT
    1   30M   30M  38.9%  ██████████  .mp4
    1   18M   18M  23.2%  ██████      .mov
    1  9.3M  9.3M  12.3%  ███▏        (no extension)
    3  8.3M  8.3M  10.9%  ██▊         .heic
    1  5.8M  5.8M   7.7%  ██          .jpg
   20   76M   76M                     the biggest extensions

-g says how old the files are, by the last change: today, this week, this month, the last 3 months, this year, 1 to 2 years, 2 to 5 years, over 5 years. A cache that is all over 5 years is a cache nobody uses.

-z says how big the files are: empty, up to 4K, 4K to 64K, 64K to 1M, 1M to 16M, 16M to 256M, 256M to 4G, over 4G. Thousands of tiny files and a few huge ones ask for different cleanups.

The biggest files

-L lists the biggest files anywhere inside the items, 20 by default (-L 50 for 50), the biggest last, each with its date, both sizes, its share of everything listed and the path from the folder. The last line says how much of the total these files are.

MODIFIED          DATA  DISK      %              NAME
2025-10-12 09:41  5.8M  5.8M   7.7%  ██          Photos/panorama.jpg
2026-10-30 20:36  9.3M  9.3M  12.3%  ███▏        Projects/app/build/app
2025-06-01 10:00   18M   18M  23.2%  ██████      Movies/birthday.mov
2026-10-30 20:36   30M   30M  38.9%  ██████████  Movies/trip.mp4
                   63M   63M  82.1%              4 files of 20, their share of the total

-r puts the biggest first, -t sorts them by date and -n by name.

The card

A single file with no option, or -i with any paths, gives the card: everything about the item, one line per fact.

IMG_0412.heic
/Users/leo/Pictures/2024/IMG_0412.heic
KIND      HEIF image, 4032 x 3024
DATA      2.8M (2,891,406 bytes)
DISK      2.8M (2,895,872 bytes)  5,656 blocks of 512 bytes, 4.0K block size  0.2% more than the data
MODE      -rw-r--r--@  0644  regular file
OWNER     leo (501), staff (20)
MODIFIED  2024-03-15 12:00:21  2.6 years ago
ACCESSED  2026-10-30 09:12:40  3 hours ago
CREATED   2024-03-15 12:00:21  2.6 years ago
LINKS     1
INODE     60529371  on device 16777229
XATTRS    com.apple.quarantine (57B): downloaded with AirDrop on 2024-03-15
VOLUME    /System/Volumes/Data (apfs, disk3s1): 221G free of 926G, 76.1% used
LineWhat it says
The name and, below it in grey, the full path
KINDWhat the item is by its bytes, with what the header tells: a PNG, JPEG, GIF, WebP, HEIC, TIFF or BMP image and its dimensions; a QuickTime, MPEG-4, Matroska, WebM or AVI movie and its duration (and its frame size when the header has it); a WAVE, FLAC, MP3, Ogg, AIFF or MPEG-4 audio file with its channels, rate and duration; a PDF and its version; a ZIP, tar, gzip, xz, zstd, 7z, RAR or Java archive, an Android package or an Office document with how many files it holds; a SQLite database and its size in pages; a Mach-O or ELF executable or library with its architectures and whether it is signed; a Windows program; a WebAssembly module; a font; a disk image; and text, with its lines, encoding (ASCII, UTF-8, UTF-16...) and line ends (LF, CRLF, mixed), as JSON (valid or not), XML, HTML, SVG, a script with its interpreter, a PEM key or certificate, Markdown, or by its extension (Go source, C header...). A few hundred kinds in all. When the bytes say nothing, the name decides; when the two disagree, the card says so: plain text (named as JPEG image)
DATAThe bytes in the file
DISKThe space it takes, in 512-byte blocks, with the block size of the volume and how it compares with the data (compressed and sparse files take less; a few more bytes are the block rounding)
MODEPermissions as ls -l writes them, in octal, and the type (regular file, folder, symbolic link, named pipe, socket, character or block device)
OWNERUser and group, with their ids
MODIFIED, ACCESSED, CHANGED, CREATEDWhen the content was last written, when it was last read, when the inode changed (permissions, owner, links; only when it differs from MODIFIED) and when the file was created (macOS), each with how long ago
LINKSHow many names the file has; more than one is a hard link
INODEThe inode and the device it is on
FLAGSOn macOS, the file flags that are set: hidden, locked, system locked, SIP, compressed, in the cloud, append only, no dump...
XATTRSThe extended attributes, with their sizes; the quarantine of a download is decoded (which app brought it, when), and so are the text encoding and the origin URL of Linux desktops
TARGETFor a symbolic link, where it points and where that ends up, or broken
VOLUMEThe volume the item is on, its type and device, free space and use
SHA-256With --hash, the SHA-256 of the whole file

A folder's card has its own lines: KIND says what the folder is when it can be told (Git repository, Go module, Node.js package, Rust crate, Swift package, Python project, application bundle, Xcode project, mount point...); INSIDE counts the files and folders, how deep they go, the symbolic links, empty folders, empty files and hidden items; MODIFIED is the newest change anywhere inside, with the file that changed, and OLDEST the oldest; LARGEST lists the five biggest files; BY KIND and BY AGE give the shares, as in -y and -g.

Projects/
/Users/leo/Projects
KIND      folder, Git repository, Go module
INSIDE    1,204 files, 87 folders, 9 levels deep; 3 symbolic links, 2 empty folders, 41 hidden
DATA      1.1G (1,181,116,006 bytes)
DISK      1.2G (1,247,039,488 bytes)  5.6% more than the data
MODE      drwxr-xr-x  0755  folder
OWNER     leo (501), staff (20)
MODIFIED  2026-10-28 16:58:03  2 days ago  app/src/main.go
OLDEST    2021-10-01 09:00:00  5.1 years ago
ACCESSED  2026-10-30 12:40:11  just now
CREATED   2021-10-01 09:00:00  5.1 years ago
INODE     58610463  on device 16777229
LARGEST    310M  app/build/app.zip
           184M  app/build/app
            52M  site/assets/video/intro.mp4
            21M  app/vendor/sdk.a
            12M  site/assets/fonts/display.ttf
BY KIND   archives 520M (43.4%), code 390M (32.5%), programs 184M (15.3%), video 52M (4.3%), the rest 54M (4.5%)
BY AGE    this week 610M (50.9%), this month 320M (26.7%), this year 210M (17.5%), the rest 59M (4.9%)
VOLUME    /System/Volumes/Data (apfs, disk3s1): 221G free of 926G, 76.1% used

The card is the only view that opens a file, and only the one it describes: it reads the first 16 KB to tell what it is, counts the lines of a text file, lists the entries of an archive, and reads the whole file only for --hash. -s or -b with a single file gives the list line instead of the card.

JSON

-j writes the current view as JSON, the same facts as the screen: sizes in bytes (data, disk), dates in RFC 3339, names in snake_case. The list is {folder, items, total}; the tree adds children to each item; -y gives {kinds, extensions}, -g {ages}, -z {sizes}, -L {files}; the card is one object (or an array, with several paths) with everything on it: kind, details, text, markers, largest_files, kinds, ages, sizes, xattrs, flags, volume, sha256. The map has no JSON.

inspector -j -L 3 ~/Movies | jq '.files[].path'
inspector -j movie.mp4 | jq '.kind, .details'

Fitting the terminal

On a terminal, inspector writes a header and only the columns that fit in its width, leaving out the least important first: GROUP, DATA, FOLDERS, MODE, OWNER, FILES, MODIFIED, the bar and %. DISK and NAME always stay. The notes are shortened to the width, the path of the largest file from the left. A wider window shows more. The tables of the other views lose columns the same way.

In a pipe or a file there is no header, no bar and no limit: every column is written. -s leaves only the size and the name, and -b writes exact byte counts, for scripts.

Options

OptionWhat it does
-T, --treeThe tree of the first levels
-m, --mapThe map
-y, --kindsBy kind of file and extension
-g, --agesBy the time since the last change
-z, --sizesBy the size of each file
-L, --largest NThe N biggest files anywhere inside (20)
-i, --inspectThe card of each path
-j, --jsonThe view as JSON (not the map)
-a, --apparentSort and total by DATA, the bytes in the files, instead of DISK
-r, --reverseBiggest (newest, most files, Z) first
-n, --nameSort by name
-t, --timeSort by MODIFIED, the newest last
-c, --countSort by the files inside, the most last
-d, --depth NLevels in the tree (2)
--min sizeFold the items smaller than this into one line: 10M, 1.5G or 2%; in the tree, of each folder (1%)
--hashThe SHA-256 of a file, on its card
-s, --shortOnly the size and the name
-b, --bytesExact byte counts (1,234,567) instead of 1.2M
-x, --one-file-systemDo not go into folders on other disks or mounts
--color auto, always or neverColour in the output; auto colours only on a terminal
--no-progressNo progress line
-h, --helpThe options
-v, --versionThe version
--updateBring the newest version
--update --checkOnly say whether there is a newer version
--manpagePrint the man page
--completions bash, zsh or fishPrint the completion script for the shell

Short options go together: inspector -rT is inspector -r -T, and -d3 or -L50 take their number attached. -n, -t and -c each pick an order, and the views each pick a view, so only one of each at a time. Everything after -- is a path, even if it starts with -.

Progress

When measuring takes more than a moment, a line shows how it is going:

⠹ measuring [###########.........] 17/28  146,130 files  11G  Movies

The bar counts the items that are done, followed by the files and bytes counted so far and an item still being measured. The line is erased before the view is printed, and it never goes into a pipe or a file. Ctrl-C stops and erases it.

Sizes

Speed

Many folders are read at the same time. On macOS, the names and sizes of a whole folder come back from the system in one call (getattrlistbulk) instead of one call per file, which makes inspector 2 to 4 times faster than du on the same folders. The kinds, ages, sizes and biggest files are counted on the same pass, so the other views cost nothing more than the list. The first run over a large folder is the slowest; the system keeps what it read, and the next runs are quicker.

Colour

Colour is on when the output is a terminal and off in a pipe or a file. The NO_COLOR environment variable turns it off; --color always turns it on anyway, and --color never off. Terminals that announce 24-bit colour (COLORTERM=truecolor) get the smooth gradient in the bars and the map; the others get the nearest of the 256 colours.

Exit status

CodeWhen
0Everything was shown
1A path did not exist or could not be read
2A wrong option
130Stopped with Ctrl-C

Privacy

inspector looks at what the system says about each item (names, sizes, dates, owners, permissions, flags, extended attributes) and, for the card only, at the file it describes: its first bytes to tell what it is, its lines when it is text, its entries when it is an archive, and the whole of it only with --hash. Nothing is written, and nothing leaves the machine: it reaches the network only when you run inspector --update. No accounts, no telemetry.

Updates

inspector --update checks the site for a newer version and installs it (through Homebrew for a Homebrew copy); inspector --update --check only tells. The program never checks on its own.

Help and bug reports

Problems and ideas: the support address at the end of the inspector page. Include inspector --version and the system.