Skip to content

Instantly share code, notes, and snippets.

@JeyDi
Created January 15, 2024 08:57
Show Gist options
  • Select an option

  • Save JeyDi/23100317f0df96f72e2e589bba7e4b7c to your computer and use it in GitHub Desktop.

Select an option

Save JeyDi/23100317f0df96f72e2e589bba7e4b7c to your computer and use it in GitHub Desktop.
Tmux cheatsheet

Tmux cheatsheet

I always forgot tmux command, here a simple list of commands and shortcut keys.

Another good cheatsheet online

Commands

# create a session
tmux new -s session_name

# visualize sessions
tmux ls

# visualize windows
tmux list-windows

# attach a session
tmux att -t 0

# attach a window in a session
tmux attach-session -t <session-name>

# give a name of a window
tmux rename-window <new-window-name>

# give a name of a session 
tmux rename-session <new-session-name>

# delete a window
tmux kill-window -t <window-name>

# delete a session 
tmux kill-session -t <session-name>

Shortcuts

When you are inside a window

#create a new window
CTRL + B C

# rename a window
CTERL + B .

# visualize other windows
CTRL + B W

# visualize the sessions
CTRL + B S 


CTRL + B V

# detach
CRTL + B D 

#split the window
CTRL + B %

#slit vertical
CTRL + B "

#
CTRL + B Q

# move focus to a specific window
CTRL + B <numero>

# move in senso orario finestra
CTRL + B O

# focus sulla finestra principale 
CTRL + B CTRL + 0 

# rearrange windows
CTRL + B space

# muovere dimensione finestre
CTRL

# zoom mode (also turn back to the zoom mode)
CTRL + B Z 

# Break current pane out of the window 
CTRL + B !

Other settings

Ring the bell on terminal with tmux on other windows

You can do it manually for a single command <yourcommand> && tput bel

You can also setup use the bell externally with tmux command: tmux send-keys -t <window-name> C-g

Or you can setup the bell globally. You can use the bell-style option in your tmux configuration to specify how the bell should be displayed. Here's an example:

  1. Open your ~/.tmux.conf file in a text editor.

  2. Add the following line to the file:

    set-option -g bell-style any

    This sets the bell-style option to any, which will ring the bell on the terminal when any activity occurs in a tmux window or pane.

  3. Save and close the file.

  4. Reload your tmux configuration by running the following command:

    tmux source-file ~/.tmux.conf

    This will apply the changes to your tmux configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment