dir

Display directory trees with depth, masks, filters, sorting, metadata and totals.

FilesVersion 1.2.4Stable
lil-terminal

Overview

Use dir when you need more than the flat view from cd: choose depth, masks, file or directory filters, grouping, sorting and totals without relying on a system ls or find.

Read a directory tree with purpose

Use depth, masks and sorting to turn a large tree into a question: what exists here, where is it, and which entries matter?

Syntax

lil-terminal
dir [depth] [path] [mask] [options]

Reference

dir | dir 1

show a one-level tree for the current directory

dir 0 [path]

show a flat list

dir <depth> [path]

show a tree to the selected depth

dir -R [path]

show the recursive tree

dir [path] <mask>

show matching files and only the parent directories needed to reach them

-F | -f

show directories only | files only

-p

show full paths

-G | -g

put directories first | files first

-sum

show totals for directories, files, links and size

-a | -A

sort by name ascending | descending

-e | -E

sort by extension ascending | descending

-d | -D

sort by modified time ascending | descending

-s | -S

sort by size ascending | descending

-u

show filesystem owner

Columns and sorting

Every option begins with -. In each sort pair, the lowercase flag sorts ascending and the matching uppercase flag sorts descending. -d/-D also shows modification time, -s/-S shows size and -u adds the filesystem owner. Metadata appears immediately before the name/tree column. Date, size and owner stay compact on the left, while names and paths receive the remaining width. -G/-g groups entry types without changing the selected sort key.

Filters and masks

-F limits output to real directories and -f to regular files; symbolic links remain a distinct entry type. A mask such as "*.php" filters files while retaining the parent directories needed to show where matches were found. -p expands displayed names to full lil-terminal paths.

Limits

Depth is limited to 20 and a single run scans at most 5000 entries. Symbolic-link directories are displayed but never followed recursively.

Interactive sandbox preview

Run the prepared examples directly on the page. Their results are prebuilt and shown in the browser; no terminal command is executed on the server.

Show a tree to the selected depth

Install and manage

Install the current compatible version. Choose Base for the complete feature set or Minimum for the reduced package; use upgrade to update a module that is already installed.

Base and Minimum are two packages of the same current module release, not separate command versions.

Base package

Install the complete package with local command reference and every published mode.

install dir
Minimum package

Install the reduced package. Local reference is omitted; help <cmd> -i opens the current server reference.

install dir -m
Exact public version

Install exactly this published version.

install dir -v 1.2.4
Check or update

Ask upgrade to check compatibility and replace the installed block only when needed.

upgrade dir
Remove module

Remove the extension block while leaving the core and unrelated modules intact.

install dir -u

Examples

Examples are copyable command lines, not actions executed by this website. Review paths, permissions and destructive flags before running them on a real project.

Show a tree to the selected depth
cd \sandbox | dir 2 . -G -a
archives
config
  .env.example
  app.ini
  app.json
data
  sample.csv
  sample.txt
  users.json
Show full paths
dir 0 \sandbox -p
/sandbox/archives
/sandbox/config
/sandbox/data
/sandbox/feed.xml
/sandbox/images
Show matching files and only the parent directories needed to reach them
dir 3 \sandbox "*.php" -G
src
  Calculator.php
  index.php
scripts
  task.py
Show directories only | files only
dir 2 \sandbox -F
archives
config
data
db
images
logs
public
scripts
tmp
workspace
Sort by extension ascending | descending
dir 2 \sandbox -f -e
README.txt
feed.xml
new.txt
test.txt
Sort by modified time ascending | descending
dir 2 \sandbox -d
2026-08-04 23:20:34    archives
2026-08-08 23:20:40    config
2026-08-08 20:18:28    new.txt
Sort by size ascending | descending
dir 2 \sandbox -S
 39 KB    123.jpg.tar
37.4 KB    123.jpg
1.3 KB    feed.xml
Show filesystem owner
dir 1 \sandbox -u
www-data    archives
www-data    config
www-data    feed.xml
Show totals for directories, files, links and size
dir 2 \sandbox -sum
archives
config
data
...

Directories  10
Files  18
Links  0
Size  44.2 KB
Show directories only | files only
dir 2 \sandbox -F -f
Conflicting filters

File used in this example: sandbox/README.txt

The example uses a file or directory from the protected /sandbox/ documentation workspace.

lil-terminal documentation sandbox

This directory is part of the server tree: website_e36e9fed/sandbox/.
It is never included in generated lil-terminal downloads and direct HTTP access is blocked.
The documentation renderer reads only explicitly allow-listed files from here and
uses them to show real, reproducible command examples.

The fixtures are intentionally small and contain no secrets. They cover PHP, HTML,
CSS, JavaScript, JSON, INI, SQL, Python, shell, XML/SVG, CSV, plain text, logs,
images, .lil workflows, archives and temporary work paths.

During module review, examples may be refined together with the command. Keep paths
stable whenever possible because public documentation links refer to them.

Related documentation

Current public release

v1.2.42026-08-13

More readable metadata

Widens metadata spacing and aligns compact byte-size values while keeping standard B, KB, MB, GB and TB units.