Tmux Quickstart

19 June 2022

Terminal multiplexers are applications described as offering a single management pane that allows control and maintenance over multiple terminal sessions.

Tmux initially released in 2007 and is the original open-source terminal multiplexer for Unix-like operating systems. As well as command-line program management, it can also detach processes from their controlling terminals, allowing remote sessions to remain active without being visible.

Installation

Full instructions are available from the tmux GitHub README.

For Mac users, using homebrew, it's a single, simple command:

brew install tmux

Up & Running

Running the program is as you might expect:

tmux

You should find yourself in a new terminal environment. At this moment, not too much differs from a default terminal session, but do note the new control panel on the bottom edge.

Mac OSX iTerm/Tmux Backspace Fault

Should you also encounter a glitch with the backspace functionality not correctly removing characters, consider the guidance offered in this Stack Overflow answer. The gist is to run these commands to extend the base configuration:

curl -LO https://invisible-island.net/datafiles/current/terminfo.src.gz && gunzip terminfo.src.gz

sudo /usr/bin/tic -xe tmux-256color terminfo.src

Commands


# Start tmux
tmux

# New pane
Ctrl + b, % (vertical split)
Ctrl + b, " (horizontal split)

# Switch pane
Ctrl + b, [arrow key]

# Close pane
exit



# Create window
Ctrl + b, c

# Switch window
Ctrl + b, [number]

# Rename window
Ctrl + b, ,



# List current sessions
tmux ls

# Create new session
tmux new -s [session-name]

# Reattach to a session
tmux attach -t [session-name]

# Rename a session
tmux rename-session -t [session-name-old] [session-name-new]

# Detach a session
Ctrl + b, d

# Kill a session
tmux kill-session -t [session-name]



# Scroll through log
Ctrl + b, [

# Quit scroll
q

# Enter copy mode
Ctrl + b, PgUp

References

https://github.com/tmux/tmux/wiki/Getting-Started

https://en.wikipedia.org/wiki/Terminal_multiplexer

https://www.youtube.com/watch?v=Yl7NFenTgIo&ab_channel=HackerSploit

https://www.youtube.com/watch?v=bdumjiHabhQ&ab_channel=ThePrimeagen

https://stackoverflow.com/questions/51488920/backspace-not-working-in-tmux-command-prompt

https://opensource.com/article/21/5/linux-terminal-multiplexer