learntmux.dev

Start your first session

Goal

Be attached to a session named learn, with [learn] on the green status line.

tmux new -s name starts tmux and drops you into a session called name. The green bar at the bottom is the status line: [name] on the left is the session, 0:sh* next to it is its one window.

Everything in tmux nests, and each layer has one job:

server
runs in the background and holds everything; starts on your first tmux command
session
a set of windows; this is what you attach to and detach from
window
fills the screen, like a tab
pane
a rectangle inside a window running one program, usually a shell

Your terminal is a client talking to the server. The server exits when nothing is left running in it.

Do this

Run tmux new.

The screen clears and a green status line appears, reading [0] 0:sh* — session 0, one window named after the shell.

Type exit.

The shell ends, the session with it, and you are back at the plain prompt.

Run tmux new -s learn -n shell.

The status line now reads [learn] 0:shell*. Stay attached.

What the default names are

Without -s the session is called 0, then 1, and so on. Without -n the first window is named after the program running in it, sh here.

Stuck on this one?

This is a live terminal. Typing goes to the machine, including Tab. Press Shift and Tab together to move focus back out to the page.

A real terminal, in this tab

about 15 MB, once

session learn

Done when

not started
  1. A session named learn exists on the tmux server— not done yet
  2. One client (the learner's terminal) is attached to session learn— not done yet