Run commands from the command prompt
Session learn has a window logs that is not current, and a window running top.
C-b : opens the command prompt in place of the status line. Type a tmux command, Enter runs it, Escape cancels. Do not type tmux in front — you are already talking to it.
C-b c is just new-window with no flags. The prompt is where you add them:
-d- create the window without switching to it
-n name- name it, instead of letting it take its program’s name
- a word after the flags
- a program to run in place of the shell
Most commands have a short alias: new-window is neww, new-session is new, list-keys is lsk.
Press C-b :, type neww -d -n logs, Enter.
The list reads 0:shell* 1:logs — the new window exists but shell stays current.
Press C-b :, type neww top, Enter.
A window running top opens and becomes current: 2:top*.
What the prompt does with output
Flags work as in the shell, and ; separates several commands on one line. A short result shows on the status line; longer output opens in view mode, which q closes.
Here is what just happened.
-d kept the session on its current window, and -n logs named the new one instead of letting it take its program’s name. A word after the flags is a program to run in place of the shell, so the second window runs top. Both went to the next free index, exactly as C-b c does.
- Open the tmux command prompt in place of the status line (Enter runs, Escape cancels)C-bthen:
- Create a named window without making it current:neww -d -n name
- Create a window running a program instead of a shell:neww command
Go further
-t 9puts the new window at index 9 instead of the next free one.lswat the prompt prints the window list with more detail than the status line.- Flags without values combine:
-dn logsis-d -n logs.
- 1Type only the command at the prompt, not
tmuxin front of it. - 2
newwis short fornew-window.-dopens it without switching;-n namenames it. A word after the flags is a program to run. - 3
C-b :thenneww -d -n logs, Enter. ThenC-b :again,neww top, Enter.
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
Alpine Linux and tmux 3.4 on an x86 emulator. Nothing to install, and no server behind it.
about 15 MB, once
Done when
not started- Window logs exists in session learn and is not the current window— not done yet
- A window in session learn is running the top program— not done yet