Tullio Facchinetti

Terminal-friendly tmux cheatsheet

by Tullio Facchinetti

Categories: article lang_en article_en


I typically use tmux when working on remote servers, but sometimes I don’t remember keybindings or commands for some functions that I rarely use.

Since I find the tmux help/manpage rather confused, I usually revert to this cheatsheet, which is very well organized. However, I’d want to avoid to rely on a webpage for documentation that I would better checkout in the terminal, maybe using grep.

Solution

For this reason I packaged a text file with the same content reported in the above mentioned cheatsheet, with a format that is terminal friendly.

This is an excerpt of the file:

-------------------------------------
Sessions
-------------------------------------

$ tmux                                start a new session
$ tmux new                            start a new session
$ tmux new-session                    start a new session
: new                                 start a new session

$ tmux new -s mysession               start a new session with the name mysession
: new -s mysession                    start a new session with the name mysession

$ tmux kill-ses -t mysession          kill/delete session mysession
$ tmux kill-session -t mysession      kill/delete session mysession

$ tmux kill-session -a                kill/delete all sessions but the current

Ctrl + b $                            rename session

Ctrl + b d                            detach from session

Organization for effective search

I organized the content so that every explanation is on the same line of the corresponding keybinding. Moreover, the “action” (e.g., open, kill, start, etc.) precedes the “target object” (e.g., window, pane, etc.).

In this way, it is possible to grep the cheatsheet with a pattern like action.*object.

For example

$ grep "close.*window" tmux-cheatsheet.txt 
Ctrl + b &                 close current window

or

$ grep "resize.*pane" tmux-cheatsheet.txt 
Ctrl + b + up-arrow            resize current pane height (holding second key is optional)
Ctrl + b Ctrl + up-arrow       resize current pane height (holding second key is optional)
Ctrl + b + down-arrow          resize current pane height (holding second key is optional)
Ctrl + b Ctrl + down-arrow     resize current pane height (holding second key is optional)
Ctrl + b + right-arrow         resize current pane width (holding second key is optional)
Ctrl + b Ctrl + right-arrow    resize current pane width (holding second key is optional)
Ctrl + b + left-arrow          resize current pane width (holding second key is optional)
Ctrl + b Ctrl + left-arrow     resize current pane width (holding second key is optional)

Download

To use it locally, you can either clone the repository from github (or download the raw text file) or download the text file.

Alternatives

There are several other options. Beside the already mentioned cheatsheet, there is cheat.sh/tmux that is great, although it is not as grep-friendly as mine.


Highlights

  • Students and theses
  • Publications
  • Thesis topics
  • Curated awesome list of CLI apps
  • Last updates (English)

  • Speed up the compilation of LaTex Beamer presentations ()
  • Students and theses ()
  • Students and theses - English ()
  • Learn enough C to survive ()
  • Workflow for writing theses collaboratively ()
  • Guidelines for theses and presentations ()
  • Projects ()
  • Last updates (Italian)

  • Risultati FdI 27 Settembre 2024 ()
  • Risultati FdI 02 Settembre 2024 ()
  • Risultati FdI 25 Luglio 2024 ()
  • Risultati FdI 26 June 2024 ()
  • Risultati FdI 8 e 11 aprile 2024 ()
  • Risultati FdI 20 Febbraio 2024 ()
  • Risultati FdI 02 Febbraio 2024 ()
  • List of categories

    Article Article_en Article_it C Courses Fdi Lang_en Lang_it Latex Programming Project Research Results Robotics Software Teaching Thesis Tips