Peek is a tiny CLI tool that quickly gives you a preview of all human-readable text files in a directory. Features:
- smart file detection and support for most non-binary files, even those in obscure formats or without a file extension
- little to no setup and a small, self-contained package
- syntax-highlighted previews for code, markup and more
- fuzzy, case-insensitive search and glob pattern-based filtering
- multiple sorting options
- support for multiple platforms
Tip
This project is a command line app. It should be run from your terminal emulator of choice, not by opening the binary from a file manager!
Grab yourself a binary from the Releases tab. They're available for three platforms:
- for Windows:
peek-windows-[x86_64 or arm64].exe
- for macOS:
peek-macos-[arm64 or x86_64]
- for Linux (x86-64 / arm64):
peek-linux-[x86_64 or arm64]
Tip
Don't know what x86_64 or arm64 mean? If you're running Windows or Linux, your device is most likely to work with the x86_64 binary. If you're on an Apple Silicon (M1, M2, M3...) Mac, choose the arm64 binary.
Before you can use peek on Linux or your Mac, you have to mark the binary as an executable. From your terminal, run this command:
chmod +x peek-linux # or peek-macos
Registering peek on your PATH makes it easy to preview from anywhere. To do so, follow these steps:
- Move the peek binary into a stable folder.
- Run a command appropriate for your OS:
- macOS (zsh):
export PATH="$PATH:/path/to/folder" source ~/.zshrc
- Linux (bash):
export PATH="$PATH:/path/to/folder" source ~/.bashrc # or ~/.profile, depending on your shell
- Windows (PowerShell)
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\path\to\folder", "User")
- macOS (zsh):
Tip
You should rename the binary to peek
(or peek.exe
on Windows)
if you want to use it by just typing peek
.
Run peek in any directory to see a preview of all text files:
peek
This will show you a neat table with the filenames and first 5 lines of each file, sorted by most recently modified.
Search for and preview files with names similar to your query:
peek myfile
peek main.js
peek index
peek reamde.md # you can make typos!
Peek uses fuzzy matching, so you don't need to type the exact filename. It will find files that closely match your search term.
Get a list of all commands and options:
# print help message
peek --help
For simplicity's sake, peek only reads the text files in a given folder, excluding everything in subdirectories. To select a directory different to your current one:
peek -d /path/to/directory
peek --directory cats/
You can choose to filter files using glob-style patterns, like so:
# only show .py files
peek -p "*.py"
# only show files containing .svelte.
peek --pattern "*.svelte.*"
You can sort files by their size, names or recency:
# sort by file size (largest first)
peek -s size
peek --sorting size
# sort alphabetically
peek -s alphabetic
peek --sorting alphabetic
# sort by recency (most recently modified first) (default)
peek -s recency
peek --sorting recency
There's various display options you can try to improve your experience:
# show more lines per file (50 instead of 5)
peek -v
peek --verbose
# show line numbers in previews when syntax highlighting is on
peek -ln
peek --linenumbers
# disable syntax highlighting (faster)
peek -nhi
peek --no-highlighting
# low accuracy mode (faster, less precise file detection)
peek -la
peek --low-accuracy
If you want to troubleshoot peek, you can enable debug mode, which shows you more information when errors occur:
peek -db
peek --debug-mode
Found a bug? Want a new feature? Open an issue through the Issues tab.
-
rich, a fantastic library for terminal formatting
-
Typer, a CLI library that's literally heaven compared to argparse
-
TheFuzz, insanely easy Levenshtein Distance-based fuzzy string matching
-
charset-normalizer, a universal character encoding library
LLMs (Claude Sonnet 4, GPT-4o, and GPT 4.1) were used for research, tooling setup and debugging during development. This included library and architecture suggestions as well as feedback on mistakes and potential improvements (and also setting up GitHub Actions because it is my nemesis). All peek code was written by me.