disky is a single-file Bash TUI for interactive disk usage exploration.
___
/ \
| DISK |
| Total: 926Gi
| Used: 515Gi
| Free: 336Gi
| =================----------- | 61% used
\___/
disky — disc space — /Users/me/Src/disky
↑/↓ move Enter/→ expand ← collapse u up g/p chart d delete q quit
> ├── .. (parent) (go up)
├── ./ 320K
│ ├── .git/ ?
│ ├── disky 16K
│ ├── LICENSE 1K
│ └── README.md 5K
- Full‑screen TUI: Renders a persistent interface in your terminal with a disk gauge and a scrollable tree.
- Tree view: Files and directories rendered with box‑drawing characters (
├──,└──,│) and sizes. - Per‑directory navigation: Pressing Enter/Right on a directory enters that directory and rebuilds the tree with it as the new root.
- Session caching: Directory listings and file sizes are cached (per process) so revisiting directories is fast.
- Keyboard‑only navigation: Optimized for arrow keys and
j/k, no mouse required. - Per‑directory usage chart: Press g or p on a directory (or file) to open a full‑screen view showing how much space each child uses; press c to close the chart and return to the tree.
- Delete: Press d on a file or directory to delete it; you must type yes to confirm (Enter or anything else cancels).
git clone https://github.com/danbickford007/disky.git
cd diskyYou can then run it directly with:
./disky # analyze current directory
./disky /var # analyze /var
./disky ~/Projects # analyze your Projects folder
./disky -h # show help
./disky --help # show helpcp disky /usr/local/bin/disky # may require sudoAfter that:
disky
disky /some/path| Option | Description |
|---|---|
-h, --help |
Show usage and key bindings, then exit. |
[directory] |
Optional. Start with this directory as root; default is current directory (.). |
The core idea of disky is directory‑as‑root navigation:
- At any moment there is a current root directory.
- The tree shows that root as
.with its immediate children. - Moving into a directory (Enter/Right) changes the root to that directory and rebuilds the tree.
- Moving up goes to the parent directory and rebuilds the tree.
This keeps the UI responsive and avoids deeply nested expansions.
disky # or: ./disky
disky /tmp # start rooted at /tmpWhen the interface starts:
- The terminal screen is cleared.
- A header shows:
- A disk gauge for the filesystem containing the root path.
- A hint line with the key bindings.
- The main area shows the tree for the current root.
| Key | Action |
|---|---|
| ↑ / k | Move cursor up |
| ↓ / j | Move cursor down |
| Enter / → | If on .., go to parent directory; otherwise enter the selected directory as new root |
| u | Go up to parent directory (same as selecting .. and pressing Enter) |
| g / p | Open usage chart for the selected row’s directory (see below) |
| d | Delete the selected file or directory (confirmation screen) |
| q | Quit |
With a file or directory selected (not .. or .), press d to delete. The screen clears and shows a confirmation with a warning. You must type the word yes (and press Enter) to confirm; pressing Enter without typing yes, or typing anything else, cancels and returns to the tree. Deleting a directory removes it and all its contents.
.. (parent)— Appears at the top when the root is not/. Selecting this and pressing Enter/Right moves you one level up..— The current root directory.name/— A subdirectory under the current root.name— A file under the current root.
Each row shows:
- Name (with
/suffix for directories). - Size:
- For the root row: a
du -shstyle summary of the whole subtree. - For files: a fast stat‑based human size.
- For directories: recursive size where practical;
?for very large directories.
- For the root row: a
With the cursor on any row (directory or file), press g or p to open a usage chart for that row’s directory:
- The screen clears and shows a bar chart of how much space each child file and directory uses, with percentages and human‑readable sizes.
- The chart is for the directory of the selected row (if you’re on a file, it shows that file’s parent directory).
- Press c to close the chart and return to the tree in the same place (same root, cursor, and scroll).
- Press q from the chart to quit the program.
Very large directories may show a message instead of a chart to keep the UI responsive.
At the very top:
- Shows Total, Used, and Free space for the filesystem that contains the current root.
- Renders a bar where the filled portion reflects the percent used.
This updates automatically whenever you change the root directory.
- Directory listings and file sizes for the current process are cached under a temporary directory (e.g.
/tmp/disky_<pid>). - Large directories (more than a configurable threshold of entries) skip per‑file
statand just show?sizes to keep navigation responsive. - The cache is cleaned up automatically on exit via a trap.
- Bash (the
diskyscript uses Bash‑specific features). - Standard Unix tools:
ls,du,df,stat,tput,stty. - A real terminal (TTY); behavior is undefined in non‑interactive environments.
- macOS: Uses the BSD
statflags (stat -f%z). Tested on recent macOS releases. - Linux: You may need to adjust the
statinvocation if you port the script; currently the script is tailored for macOS/BSD‑stylestat. - Terminal size:
diskyusestput linesto determine how many tree rows fit on screen.- If the reported height is too small, it falls back to 24 lines.
-
The interface looks garbled or doesn’t clear correctly
- Make sure you are running
diskyin a real terminal, not inside something that captures/filters ANSI escapes. - Check that
TERMis set to a reasonable value (e.g.xterm-256color).
- Make sure you are running
-
High CPU usage while idle
diskyshould only repaint when something changes (tree dirty or input).- If you see constant CPU usage, check for issues with your terminal emulator or any wrapper tools.
-
Weird characters instead of tree lines
- Make sure your terminal is using UTF‑8 and a font that supports box‑drawing characters.
- All logic lives in a single Bash script:
disky. - The script avoids
set -ebecause some commands (clear,du,read, etc.) can fail in normal interactive use. - Terminal state (
stty) is saved and restored on exit so your shell remains usable after quitting.
disky is licensed under the MIT License.
See the LICENSE file for full terms.