Skip to main content

Sparking tmux guide

·335 words·2 mins
Orlando Gentil
Author
Orlando Gentil
Jack of all trades, master of none
Table of Contents
Just sparking interest in t(erminal)mu(ltiple)x(er)

tmux is a terminal multiplexer1. it enables a number of terminals to be created, accessed, and controlled from a single screen. tmux may be detached from a screen and continue running in the background, then later reattached.”2

How tmux is organized
#

tmux hierarchy:

  1. Sessions
    1. Windows
      1. Panes - like tabs. The result of split windows

Default prefix indicates that CTRL + b should be pressed and then the key or sequence.

tmux command mode - prefix + : (or CTRL + b + : )

My most used commands and key bindings
#

commands (anywhere)
#

Open tmux command mode and type set -g mouse on to enable mouse support

leaving
#

What do you want to do Command
leave Ctrl + d or exit
dettach prefix + d

Sessions
#

What do you want to do Command
New unnamed session tmux
New named session tmux new -s session_name
Atach Session name tmux attach -t session_name
Switch session tmux switch -t session_name
List Sessions tmux list-sessions

Windows
#

What do you want to do Command
create a new window prefix + c
Browse windows (all sessions) prefix + w
Switch windows using numbers [0-9] prefix + [0-9]

Panes
#

What do you want to do Command
split vertically prefix + %
split horizontally prefix + "
circle planes prefix + o
show numbers prefix + q
zoom pane prefix + z
switch panes layout prefix + <space>

Most effortless way to navigate windows/panes
#

prefix + w and use the arrows to select where to go.

Simple sharing session
#

user01 commands
#

  1. Create session specifying the socket
tmux -S /path/to/sock
  1. Grant permissions to the user on the socket
# very lazy way
chmod 777 /path/to/sock
# if the users have a common group
chgrp <shared group> /path/to/sock
chmod g+rwx /path/to/sock

user02 commands
#

  1. Attach to the sessionWithin the tmux session
tmux -S /path/to/sock attach

Sharing session with more resources
#

https://github.com/zolrath/wemux

Plugins
#

https://github.com/tmux-plugins/list?tab=readme-ov-file

References
#

https://tmuxcheatsheet.com