Getting Started with Rex / Chapter 1 — Getting Started with Rex (lessons 1–4) / Lesson 1

What Rex Is — Terminal, Multiplexer, and Server

Time needed: about 7 min (estimate)

☆ Read later

You can try the opening of this lesson without an account.

Rex is both a terminal and a multiplexer

Rex is a terminal and multiplexer in one, made by a company called Superlogical. The first line of rex --help reads "The multiplexer for all work." The macOS app (Rex.app) is itself the terminal, and it holds sessions, tabs, and panes. Terminal rendering is done with a piece of Ghostty (libghostty).

Terminal

$ rex --help The multiplexer for all work. Usage: rex [command] [flags] Common commands: new Create a session ls, list List sessions run Run a command in a new block split Split the focused block …

The server holds the state

The key idea in Rex is that the Rex Server holds the state. Both the app and the rex command are just "clients" that connect to the server. The help text says: "A client is one program connected to the server, such as Rex.app or this command."

How it fits together

Rex Server holds the state of sessions, tabs, and panes ├─ Rex.app a client that draws the screen (the terminal) └─ rex a client you drive with commands (the CLI)

That's why closing and reopening the app doesn't lose your work. The official docs say that when you restart a client, Rex "restores all your sessions as-is with full history." Even when the server restarts, sessions, tabs, panes, and their labels come back. Programs that support the Program Resume Protocol resume; otherwise Rex starts a shell again in the last working directory.

How it differs from tmux

tmux also runs a server behind the scenes, but it's a separate tool that you run inside a terminal app. For a remote machine, you ssh in first and then attach to tmux. In Rex, the terminal app itself is a client of the server, and both the app and rex can connect straight to a server on another machine (Lesson 17). tmux keys and options don't apply to Rex, so learn Rex's own way of doing things.

Checking the shape of IDs

When you create a session with rex new and pass --json, it returns the IDs of what it created. Below is the real output from a temporary session made for this course. In the CLI, a window is a tab and a block is a pane. Let's pull out each ID's prefix and its last characters in Python.

editor.py

Tab indents. To leave the editor, press Esc, then Tab.

Create a free account to keep reading

With an account you can read the rest of this lesson, take the quiz, and read every free lesson in this course. Lessons you answer correctly are recorded as complete.

Report a problem with this lesson

Log in to send a report.

Keyboard shortcuts

Keys available in a lesson
KeyAction
[ or Alt + ←Go to the previous lesson
] or Alt + →Go to the next lesson
?Open this list
EscClose this list

The keys do not work while the cursor is in a code editor or an input field.