tmux is an [[ISC]] licensed terminal multiplexer written in [[3. Reference/Software/Programming Languages/C|C]].
- [Website](https://tmux.github.io/) (seems to no longer have a dedicated website)
- [GitHub](https://github.com/tmux/tmux)
- [Documentation](https://github.com/tmux/tmux/wiki)
- AlternativeTo
- [Arch Wiki](https://wiki.archlinux.org/title/Tmux)
> **tmux** is an [open-source](https://en.wikipedia.org/wiki/Open-source "Open-source") [terminal multiplexer](https://en.wikipedia.org/wiki/Terminal_multiplexer "Terminal multiplexer") for [Unix-like](https://en.wikipedia.org/wiki/Unix-like "Unix-like") [operating systems](https://en.wikipedia.org/wiki/Operating_system "Operating system"). It allows multiple [terminal](https://en.wikipedia.org/wiki/Computer_terminal "Computer terminal") sessions to be accessed simultaneously in a single window. It is useful for running more than one [command-line](https://en.wikipedia.org/wiki/Command-line_interface "Command-line interface") program at the same time. It can also be used to detach [processes](https://en.wikipedia.org/wiki/Process_(computing) "Process (computing)") from their controlling terminals, allowing remote sessions to remain active without being visible.
\- via [Wikipedia](https://en.wikipedia.org/wiki/Tmux)
# Notability
I switched to `tmux` from [[GNU Screen]] probably before 2010. As of [[2023-10-30]] it is still the multiplexer that fits my needs.
## Derivatives
- Tmux-Sixel
- A family of forks of Tmux to improve graphics support
- It has been forked and continued by different people again and again over the years, the network graph is wild
- https://github.com/JayZhouzzj/tmux
- https://github.com/csdvrx/sixel-tmux
- https://github.com/jdssl/tmux/tree/sixel-passthrough
- https://github.com/j352lin/tmux
# Philosophy
Historically the main developer has been stubborn and nigh hostile to opposing ideas. Sometimes, eventually people convince him, other times not.
- Config Search Path (resolved)
- Since at least 2015 there were requests to check for its config files in `~/.config` but the core team discussed it previously on the mailing list and rejected the idea.
- Dec 2019 it was finally [added](https://github.com/tmux/tmux/commit/15d7e564ddab575dd3ac803989cc99ac13b57198) in the development branch
- Feb 2020 it was finally [part](https://raw.githubusercontent.com/tmux/tmux/3.1/CHANGES) of an official release
- Apr 2020 it was [fixed](https://github.com/tmux/tmux/commit/f87be8d0521436c47151233f781794dee94fc1df#diff-c949f93d03f44a4217d7a138f9e2e54aR16) to properly read the environment variable instead of being hard coded
- Breaking Changes
- The `tmux` core team is very sensitive to complaints about breaking changes. And will often respond harshly to users who bring them up.
- Sometimes they do properly deprecate and announce they're removing things in advance. But usually they make breaking changes and the only way to know it was deprecated was to have read a footnote in a changelog from sometimes years before you even started using the program.
- Like yeah it's great that they (sometimes) give people a long time to transition ... but that time is useless if no one knows about it. It is perfectly the example of Arthur Dent's house and Earth being demolished.
- The main developer claims to believe that every time any piece of software is updated, that users should read the update notes and possibly even the source code. This is obviously absurd. Every 2 weeks hundreds of updates might be pushed. And each of those is going to be in a different style, granularity, and programming language.
# OS Support
# Features
# Tips
See also: [[tmux stuff]], [[tmux, a BSD alternative to GNU Screen _ Niall's Weblog]]
## Send Control Codes to Terminal Emulator (passthrough)
>it can be forced to pass an escape sequence through by wrapping it in a special form of the DCS sequence with the content prefixed by tmux;. Any \033 characters in the wrapped sequence must be doubled
> As of tmux 3.3, the `allow-passthrough` option must be set to `on` or `all` for the passthrough sequence to work.
\- tmux FAQ
> If set to `on`, passthrough sequences will be allowed only if the pane is visible. If set to `all`, they will be allowed even if the pane is invisible.
\- tmux man page
```sh
tmux set allow-passthrough on
```
```sh
echo -e "\ePtmux;CONTROL_CODES\e\\"
```
## Popup Windows
Tmux supports popping up centered panes from the `display-popup` command.
These popups are closed by pressing the `esc` key or by passing `-E` to the command so that it auto-closes when the inner command exits.
## Get Connected Terminal Emulator Info
Similar to `$TERM`, except it returns the value from the terminal emulator connected to tmux, and provides a more detailed and accurate answer.
```sh
display-message -d 0 '#{client_termtype}'
```
Using the above [[#Send Control Codes to Terminal Emulator (passthrough)|control code passthrough]] we can query the outer terminal emulator directly using the [[ANSI - Terminals#Terminal Type Query|ANSI DCS terminal info sequence]]:
```sh
echo -e "\ePtmux;\e\e[>q\e\\"
```
## Change Pane Layout
Swaps the available panes through multiple layout presets including: even-horizontal, even-vertical, main-horizontal, main-vertical, or tiled. These can also be changed to directly with `ALT-n` where `n` is the number in the order starting at 1.
```sh
<prefix> space
```
## Rotate Pane Contents
Rotate the contents of all panes through the existing layout.
```sh
<prefix> ctrl+o
```
## Swap Pane Contents
Move the active pane's content to another pane to the right or left.
```sh
<prefix> {
<prefix> }
```
# References