S∆SS.

S∆SS Studio Notes · Tmux · Nº 01

Tmux — 01 Creating, Naming and Closing Windows

The basics of creating a Window, renaming it, selecting it by number and closing it safely. These instructions use the default prefix, C-b.

§ 00 · Window — switch tasks without cluttering the screen

A Window is an independent screen inside a Session. Each Window has a name and index and contains one or more Panes. If you do not need to see several tasks simultaneously, separate Windows are easier to read than a screen split into many small Panes.

For example, put a conversation, a development server and a log in separate Windows. Each program then uses the full screen, and you switch by name. A Window name is a label for the purpose of the task you want to remember, not the state of the program.

§ 01 · Creating and switching — c, n, p, numbers and w

C-b c creates a new Window and switches to it. C-b n selects the next Window, C-b p the previous one, and C-b l the last Window you viewed. C-b 0 through C-b 9 select the Window with that index directly.

If you have too many Windows to remember their numbers, use C-b w to open tree mode and choose from the list of Sessions and Windows. The status line shows each Window’s index and name: use numbers for fast navigation and names to identify tasks.

Basic Window shortcuts
ShortcutFunctionNote
C-b cCreate a new WindowA new shell opens and that Window becomes the current screen
C-b ,Rename the current WindowType the name and press Enter
C-b n / pNext / previous WindowWraps around at the end of the list
C-b lLast WindowQuick for switching between two tasks
C-b 0–9Select the given indexThe number is a position within the Session, not a name
C-b wOpen the list and selectFind a Window by name when there are many

§ 02 · Renaming — C-b ,

Press C-b , in the current Window to open the rename-window input on the status line. Delete the old name, enter a name that shows its purpose—such as notes, server or review—and press Enter. Window names can repeat, so check the index too.

If you prefer a command prompt, open the tmux command prompt with C-b : and run rename-window new-name. If a name unexpectedly changes again, check automatic-rename or the title-changing settings of the running program.

§ 03 · Closing — exit the program or kill the Window with C-b &

Running exit in a shell or closing the shell normally with Ctrl-d closes that Pane. When the last Pane closes, the Window disappears too. If a program is running, the safest approach is to save and exit using that program’s own shutdown procedure first.

C-b & asks whether to forcibly close the current Window and every Pane inside it. Unsaved editors and running tasks may end with it. Use C-b x to close just one Pane. Even when closing “one unused Window,” check the current Window and the processes inside it before answering the & confirmation.

Read this note at sass.studio.