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)

  • Students and theses ()
  • Students and theses - English ()
  • Learn enough C to survive ()
  • Workflow for writing theses collaboratively ()
  • Guidelines for theses and presentations ()
  • Projects ()
  • Shortcuts for Bash ()
  • Last updates (Italian)

  • Risultati FdI 21-25 Novembre 2022 ()
  • Studenti e tesi ()
  • Risultati FdI 29 Settembre 2022 ()
  • Risultati FdI 02 Settembre 2022 ()
  • Risultati FdI 28 Luglio 2022 ()
  • Risultati FdI 29 Giugno 2022 ()
  • Interfacciamento client-server con il simulatore di propagazione del calore Energy2D ()
  • 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