# Cheat Sheet

## Install&#x20;

```
apt update
apt install tmux
```

## Sessions

### Create new

```
tmux new -s my-session
```

### Use existing session

```
tmux new -A -s my-session
```

Or you can list all sessions:

```
tmux ls
```

And attache to an existing one:

```
tmux attach-session -t my-session
```

### Delete/Kill session

#### Kill all sessions

```bash
tmux kill-server
```

#### Kill specific session

```
tmux kill-session -t my-session
```

#### Kill other sessions

If you are inside a tmux session you would like to keep and kill all others, run:

```
tmux kill-session -a
```

## Windows and Panes

* `Ctrl+b` `c` Create a new window (with shell)
* `Ctrl+b` `w` Choose window from a list
* `Ctrl+b` `0` Switch to window 0 (by number )
* `Ctrl+b` `,` Rename the current window
* `Ctrl+b` `%` Split current pane vertically into two panes
* `Ctrl+b` `"` Split current pane horizontally into two panes
* `Ctrl+b` `o` Go to the next pane
* `Ctrl+b` `;` Toggle between the current and previous pane
* `Ctrl+b` `x` Close the current pane
* Enable `synchronize-panes`: `ctrl+b` then `shift :`. Then type `set synchronize-panes on` at the prompt. To disable synchronization: `set synchronize-panes off`.
* `Ctrl+b` `[` To enable copy mode. Use arrows to scroll.
* `Ctrl+b` `Alt + 1` All panels on vertical with same width.
  * Or run `Ctrl+b` `Shift + :` `select-layout even-vertical`&#x20;
* `Ctrl+b` `Alt + 2` All panels on horizontal with same height.
  * Or run `Ctrl+b` `Shift + :` `select-layout even-horizontal`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.devops.buzz/public/tmux/cheat-sheet.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
