Skip to content

tmux Notes

ipatch edited this page Apr 10, 2018 · 46 revisions

Contents

Gotchas

Gotchas truecolor support

🚨 Getting truecolor 24 bit color support working in tmux is a total pain the ass.

⚠️ The tmux server MUST be restarted when adjusting the below settings. Reloading the configuration is not enough!

Add the below lines to the tmux.conf file to get truecolor working. 🀞

set -g default-terminal "xterm-256color"
set-option -ga terminal-overrides ",xterm-256color:Tc"

screen256-color handles italic font a little better within tmux as opposed to using xterm-256color but truecolor support is lost when setting tmux TERM to screen256-color within tmux.

Gotchas italic font support

General Notes

tmux is short for terminal multiplexer

  • By default all tmux key bindings will require a prefix key sequence before they are active. The prefix is initially set as control+b

  • tmux can be used for a paired programming session, ie. two people can login to the same tmux session and edit the same files.

General tmux Usage

To start a new tmux session with a particular name

tmux new-session -s [session_name]

or

tmux new -s [session-name]

To create a new tmux session in a detached

tmux new -s [session-name] -d

To list all the tmux commands

tmux list-commands

To list all the current key-bindings

tmux list-keys

To list available tmux sessions

tmux list-sessions

or

tmux ls

To display a list of sessions known to the local box

<kbd>prefix</kbd> then <kbd>s</kbd>

To attach to a tmux session using its name

tmux attach -t [session-name]

To kill a tmux session using its name

tmux kill-session -t [session-name]

To cycle through various pane layouts in tmux

prefix refers to pressing control + whatever key you have assigned ie. in my situation it would be control + s

prefix then spacebar

To detach from a tmux session
prefix + d

To get a list of all keybindings and associated commands that trigger these bindings prefix + ?

When using the -r flag in conjunction with the bind keyword in the .tmux.conf file it allows one to repeat a command without having to repeatedly input the prefix

To get scroll back history when using tmux with iTerm2, see πŸ’³

Working with Windows

To rename a tmux window prefix+,

Working with Panes

To maximize a pane within a tmux window prefix + z

To restore the pane to the previous size prefix + z

Pair Programmming with tmux

  1. The first user on the system can start a tmux session
tmux new-session -s apples-and-oranges
  1. The second user on the system can connect to the existing session
tmux new-session -t apples-and-oranges -s user2session

Useful Links πŸ”—

TODOs

  • Read the following article about using shared clipboard to solve issues with cross system copy / paste.
  • figure out starting a interactive fish shell session within tmux, the $fish_users_paths are duplicating.

Clone this wiki locally