tmux
is a powerful terminal multiplexer that allows you to manage multiple terminal sessions from a single window. It’s widely used for its ability to detach and reattach sessions, split windows, and much more. Below are some of the most commonly used tmux
commands along with their long-form and short-form (where applicable):
Start a new session
- Long form:
tmux new-session
- Short form:
tmux new
or justtmux
List sessions
- Long form:
tmux list-sessions
- Short form:
tmux ls
Attach to an existing session
- Long form:
tmux attach-session
- Short form:
tmux attach
ortmux a
Detach from the current session
- There’s no long form specifically for detaching. You detach using a key binding:
Ctrl-b d
.Ctrl-b
is the default prefix key fortmux
commands, followed byd
to detach.
Kill a session
- Long form:
tmux kill-session
- To kill a specific session, use:
tmux kill-session -t session-name
Split window horizontally
- This action is performed with a key binding:
Ctrl-b "
(that’s the Ctrl key and b together, then"
). There’s no direct long or short command form for this action from the terminal.
Split window vertically
- This is another key binding action:
Ctrl-b %
. Like horizontal split, there’s no command line form for this action.
Switch to another window
- Key binding:
Ctrl-b
followed by the window number. There’s no specific long or short command form for switching windows via the command line. However, you can usetmux select-window -t :0
to select window number 0 programmatically.
Rename the current window
- Long form:
tmux rename-window
- There’s no specific short form, but you can rename a window by invoking the rename command with
Ctrl-b ,
(comma) after setting the prefix.
Create a new window
- Long form:
tmux new-window
- Short form:
tmux neww
Kill the current window
- Key binding:
Ctrl-b &
. There’s no long or short command line form specifically for killing the current window.
List windows
- Long form:
tmux list-windows
- Short form: There’s no specific short form for this command.
Remember, most tmux
actions while inside a session are done through key bindings starting with the Ctrl-b
prefix (or whatever prefix you have set), followed by a command key. The commands mentioned for use in the terminal (outside of a tmux
session) generally deal with session management rather than window or pane management within a session.