Tmux
JZ

Tmux
Tue, Oct 29, 2019


A good tmux setup is invaluable.

Save tmux config in $HOME/.tmux.conf

Getting Help – List all keybindings

tmux list-keys

Alternatively,

<prefix>:list-keys
<prefix>?

To list out tmux commands and arguments, type

tmux list-commands

We can also list out every session, window, pane, its pid, etc.

tmux info

Prefix key

By default, the prefix key is set to -b.

When searching key combinations, if you see prefix + d, that means typing Control + b together and then typing d.

The prefix can be changed in $HOME/.tmux.conf

Session Management

Sessions are useful for separating work environments.

tmux new -s session_name
    creates a new tmux session named session_name
tmux attach -t session_name
    attaches to an existing tmux session named session_name
tmux switch -t session_name
    switches to an existing session named session_name
tmux list-sessions
    lists existing tmux sessions
tmux detach (prefix + d)
    detach the currently attached session

Windows

Tabs are essentially “Windows”. One should rename all the windows to the project, otherwise it will be hard to distingush windows based on running processes alone.

tmux new-window (prefix + c)
    create a new window
tmux select-window -t :0-9 (prefix + 0-9)
    move to the window based on index
tmux rename-window (prefix + ,)
    rename the current window 

References

https://tmuxcheatsheet.com/