skip to content
Site logoSystem Design in the Smoking Room
(AI translated)

TLDR, or man for the modern age

/ 5 min read

Table of contents

TLDR1

Website

Terminal window
# For macOS
brew install tealdeer
Terminal window
# tldr <program>
tldr curl
# You can go deeper
tldr docker image

Why

Seriously, why would anyone need this? You’ve always got Claude, opencode or whatever model or harness is trendy this week right at hand. Or you can just do a quick search and find the flag you need. Or there’s always man and --help. All fair points, and pretty reasonable ones.

But let me give you a couple of examples. Say you need to quickly check how some website responds. Are you really going to fire up Postman? Nah, it’s way easier to just open a terminal and type:

Terminal window
curl -v https://myfavoritewebsite.org/

Looks like everything works.

Oh right, I was supposed to test DNS. We changed some settings recently, so I need to bypass it and send the request to a specific IP instead of the one that just showed up in the output.

I have to do this every now and then, and every single time I forget which flags it takes or how the thing is spelled.

The classic move is to just run --help:

Help

Yeah, not very informative, and it doesn’t really have what I need anyway. Let’s try man:

Man

OK, that worked, but it took way longer to find than I’d like. In this case I did remember the flag was called --resolve followed by something. Problem solved, more or less.

Sure, I could also have opened a browser and looked it up there. Or gone with “Claude, check how my site myfavoritewebsite is doing on IP X.X.X.X?”

Or you can do this instead:

TLDR

I scrolled on purpose there, otherwise the GIF would have been way too short.

You can see right away what the command does and which flags it takes, with examples and colors, all without leaving the terminal!

Let’s go

It’s a fairly big project built around a repo — a huge collection of cheat sheets for command-line tools.

Everything else is built on top of it:

  • A website where you can quickly look anything up

  • A PDF — in case you really need to print it or something

  • Clients in Python, Rust (NOT the one I recommend and cover in this post) and even C. There are actually a lot more of them

  • A whole wiki that explains what goes where

Out of all of this, my favorite is the tealdeer project.

Use it however you like. Today I’ll focus on tealdeer, the CLI client.

tealdeer-rs

Source on GitHub

Docs

Installation is easy:

Terminal window
# For macOS
brew install tealdeer
# or
sudo port install tealdeer
# For Arch
sudo pacman -S tealdeer

On the first run it downloads the page cache, which can take a while. You can refresh it manually at any time with:

Terminal window
tldr --update

There’s a lot you can configure — for example, the default language for the pages (yes, they’re not English-only). I won’t go into that here; I think you’ll figure it out.

What I do want to cover is custom pages and patches for existing ones.

Patches

Docs

Why would you even need this? Say some flag is missing from a page, and you keep needing it but don’t want to dig through the docs or open a browser — you just want it at hand. Or maybe there’s some custom tooling around an existing tool, and its syntax is easy to forget.

Let’s take plain old curl as an example and add the timeout flags to its page.

There are two flags we care about:

  • --connect-timeout

  • -m, --max-time

Here’s roughly how it works.

First, figure out where the pages live on your system. The --show-paths flag does exactly that:

Terminal window
tldr --show-paths

On my Mac it prints something like this:

Config dir: /Users/zhurik/.config/tealdeer/ (OS convention)
Config path: /Users/zhurik/.config/tealdeer/config.toml (OS convention)
Cache dir: /Users/zhurik/.cache/tealdeer (OS convention)
Pages dir: /Users/zhurik/.cache/tealdeer/tldr-pages/
Custom pages dir: /Users/zhurik/.local/share/tealdeer/pages/ (OS convention)

So the file needs to go into $CUSTOM_PAGES_DIR.

For curl, create a curl.patch.md file along these lines:

- Add timeout both to connect and to whole request:
`curl {{[-m|--max-time]}} {{5}} --connect-timeout {{5}} {{http://example.com}}`

If you did everything right, a new entry will show up at the bottom of the page.

The easiest way is to find the original markdown in the cache, copy a chunk of it and then edit it to fit your needs.

Custom pages

The idea is pretty much the same, except here you can either override pages that are already in the cache (for some custom tooling) or write pages for brand-new tools — maybe even your own.

Let’s take my tool sshrek as an example. It’s a really simple thing: a .ssh/config manager built on fzf. Something like kubectx.

Same as before, drop an sshrek.page.md file into $CUSTOM_PAGES_DIR, something like this:

# sshrek
> Wrapper around `ssh` with connection history, an fzf host picker and a jump back to the last host.
> Hosts come from `~/.ssh/config`; history lives in `$XDG_STATE_HOME/sshrek/sessions.jsonl`.
> More information: <https://github.com/Zhurik/sshrek>.
- Pick a host from `~/.ssh/config` in fzf (`ctrl-o`: config order, `ctrl-r`: recent, `ctrl-f`: frequent):
`sshrek`
- Open the picker already sorted by recency or frequency:
`sshrek {{-r|--recent|-f|--frequent}}`
- Connect to the host you used last:
`sshrek -`
- Connect to a host directly (does not have to be in the config):
`sshrek {{host}}`
- Pass extra arguments to `ssh` (everything after `--`):
`sshrek {{host}} -- {{-L 8080:localhost:80}}`
- List hosts with last connection, session count and total time, sorted by recency or frequency:
`sshrek ls {{-r|-f|--sort config|--sort recent|--sort frequent}}`
- Print the list as tab-separated fields for scripts (add `--picker` for config-only picker rows):
`sshrek ls --porcelain {{--picker}}`
- Show the preview card for a single host:
`sshrek preview {{host}}`
- Generate a shell completion script, optionally for a different command name:
`sshrek completions {{zsh|bash|fish}} --name {{cssh}} > {{path/to/completion_file}}`
- Bind sshrek to a shorter name with completion included (put it after `compinit` in zsh):
`eval "$(sshrek alias {{cssh}} --shell {{zsh|bash}})"`
- Use a different picker, ssh binary, ssh config or history directory for one run:
`SSHREK_PICKER='{{fzf-tmux -p}}' SSHREK_SSH_BIN={{ssh}} SSHREK_SSH_CONFIG={{path/to/config}} SSHREK_STATE_DIR={{path/to/dir}} sshrek`
- Show diagnostics on stderr (works with any command):
`sshrek --verbose {{ls}}`

Now you get a proper help page right in the terminal:

Sshrek

If you also want a page for a short alias, you can add one like this. I mostly call it as cssh (that’s what I named the old bash script, and muscle memory won’t let me type anything longer). So let’s add a page for the alias too:

# cssh
> This command is an alias of `sshrek`.
> More information: <https://github.com/Zhurik/sshrek/blob/main/docs/alias.md>.
- View documentation for the original command:
`tldr sshrek`

Save it as cssh.page.md and voilà:

Cssh

Wrapping up

I didn’t get into color settings, the page markdown syntax and other stuff like that. If you’re interested, I’m sure you’ll find all of it. And if not, no harm done.

Take care of yourself and your loved ones!

Footnotes

  1. Funnily enough, one of my favorite sections is named the same as the project this post is about. ↩