Show Menu
Cheatography

Commands and keyboard shortcuts for using tmux on Linux

Session Management

New session
tmux new
New session with name
tmux new -s sessio­nname
List sessions
tmux ls
Attach to session by name
tmux attach -t sessio­nname
Attach to last session
tmux attach
Kill a session
tmux kill-s­ession -t sessio­nname
Switch to next session
Ctrl+b )
Switch to last session
Ctrl+b (
Detach from session
Ctrl+b d
Rename session
Ctrl+b $
Note: commands are case sensitive. There are some parts of commands where there are also shortcuts you might see in some docume­nta­tion.

Note: Keystroke commands start with holding the ctrl key down and pressing the b key. Then release the ctrl key and press the next key. So for example to detach you hold the ctrl while pressing b then release both keys and press d.

Note: If you only have a single window and then exit out of that terminal session tmux will end session.

Vertical Split Screen

Create vertical split
Ctrl+b %
Go to next pane
Ctrl+b o
Go to previous pane
Ctrl+b ;
Move active pane to the right
Ctrl+b }
Move active pane to the left
Ctrl+b {
Move edge of pane right (resize)
Ctrl+b right arrow
Move edge of pane left (resize)
Ctrl+b left arrow
Convert pane to window
Ctrl+b !
Kill pane
Ctrl+b x
Note: When you create a vertical split screen it will create two (or more) indepe­ndent terminal window screens on the same tmux window. It will not create a new window in the windows listing or rotation.

Note: When you move a pane to the right if you issue command when pane is all the way to the end it will move around to the far left spot. If you are all the way to the left and issue the command to move left it will move around to the right most spot.
 

Tmux window management

Create a new window
Ctrl+b c
Move to next window
Ctrl+b n
Move to previous window
Ctrl+b p
Change window name
Ctrl+b , (comma)
Select window by number
Ctrl+b num
List windows
Ctrl+b w
Select window by name
Ctrl+b ' (apost­rophe)
Kill window
Ctrl+b &
Change to last used window
Ctrl+b l
Note: It is useful to list the windows prior to issuing command to switch to window by name so you have the list of windows on screen to reference when typing in the window name

Note: If you listed out window names and switched windows you will see the list when you return. Simply press Esc to clear the window list and get back to terminal prompt.

Horizontal Split Screen

Create horizontal split
Ctrl+b "
Go to next pane
Ctrl+b o
Go to previous pane
Ctrl+b ;
Move active pane down
Ctrl+b }
Move active pane up
Ctrl+b {
Move edge of pane up (resize)
Ctrl+b+up arrow
Move edge of pane down (resize)
Ctrl+b­+left arrow
Convert pane to window
Ctrl+b !
Kill pane
Ctrl+b x
Note: When you create a vertical split screen it will create two (or more) indepe­ndent terminal window screens on the same tmux window. It will not create a new window in the windows listing or rotation.

Note: When you move a pane down if you issue command when pane is all the way to the bottom it will move around to the top spot. If you are all the way to the top and issue the command to move up it will move around to the bottom most spot.
               
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          tmux the terminal multiplexer Cheat Sheet
          tmux - terminal multiplexer Keyboard Shortcuts
          Tmux Cheat Sheet