Tags:
create new tag
view all tags

tmux - terminal multiplexer

The tmux command is a newer alternative to the GNU screen tool for creating detachable windowed terminal sessions. It also allows for multiple terminal windows to be split and displayed in a single window. As screen and tmux provide similar functionality choosing one is often personal preference. tmux is more contemporary, is more efficient when creating many windows/sessions and has some defaults which may make it slightly easier for newer users to adopt. One significant advantage of tmux is that it remembers the state of your split windows when re attaching to a session!

Here is a cheat sheet of basic commands for using tmux.

#Start session
tmux

#start a named session
tmux new -s mysession_name


# keybindings
All command keybindings start with Ctrl-b

^b ? for help screen

# create a new terminal
^b c

# split current pane vertical - autocreates a new terminal (vertically split)
^b %

# split current pane horizontally - autocreates a new terminal (horizontally spilt)
^b "

# switch terminals next/previous in pane
^b n next
^b p previous

#switch to terminal by its number in pane
^b NUM #(ie ^b 2) go directly to terminal NUM

#move focus to left or right
^b -> arrow key right
^b <- arrow key left

# rename the terminal window
^b ,     then type the name

# detach from session (leaves all processes running)
^b d

# list available sessions
tmux ls


# re-attach to session
# if only single session on host
tmux att
# if multiple session -t target session based on ls listing defaults to numbers 0: 1: 2: etc...
tmux att -t 0


# rename the tmux session (assumes we are renaming target session 0: to mysession)
tmux rename-session -t 0 mysession

# exit terminals/session
You can exit individual terminals inside a session as normal with exit
If you exit the last terminal you will exit the entire session as well.
tmux will display
[exited]

# kill a session - kill a session by target name
tmux kill-session -t mysession






-- Dave Costello - 2020-05-05

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2020-05-06 - DaveCostello
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding URCS? Send feedback