dir

Explore directory trees with selected depth, filters, sorting and totals.

FilesVersion 1.2.5Stable
lil-terminal

Overview

Where cd shows one folder, dir helps you understand a whole project. For example, dir 2 displays two levels, dir .js finds JavaScript files and dir -sum adds file counts, directory counts and total size. dir is a separate module; simple navigation works with the lighter cd alone.

Read a directory tree with purpose

Use dir when you need to locate something in nested folders or understand a project layout. Masks narrow the results, -F keeps directories, -f keeps files and -p prints full paths. Recursive scans have depth and entry limits; use disk -r when you need actual recursive disk usage.

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.

dir .js: show files with a .js extension; A real .js directory takes precedence over the extension shortcut.

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.5
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
Dir · cd
cd \sandbox | dir .js
public/
  assets/
    app.js
Show the recursive tree
dir -R \sandbox\tmp
README.txt
current.txt
draft.txt
new.txt
Show a one-level tree for the current directory
dir 1 \sandbox
config/
data/
db/
images/
logs/
public/
scripts/
src/
tmp/
workspace/
README.txt
feed.xml
Put directories first | files first
dir 2 \sandbox -g
README.txt
feed.xml
config/
data/
db/
images/
logs/
public/
scripts/
src/
tmp/
workspace/
Sort by name ascending | descending
dir 2 \sandbox\tmp -A
new.txt
draft.txt
current.txt
README.txt
Sort by extension ascending | descending
dir 2 \sandbox\config -E
page.htm
app.yml
app.xml
app.toml
app.properties
app.json
app.ini
app.conf
Sort by modified time ascending | descending
dir 2 \sandbox\tmp -D
new.txt
draft.txt
current.txt
README.txt
Sort by size ascending | descending
dir 2 \sandbox\tmp -s
new.txt
draft.txt
current.txt
README.txt
Show a flat list
dir 0 \sandbox
sandbox/
├── config/
├── data/
├── public/
├── scripts/
├── src/
└── workspace/

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.52026-10-31

File-extension shorthand

dir .js filters by extension without wildcard syntax, while an existing .js directory remains addressable.