Skip to content

Instantly share code, notes, and snippets.

@umhan35
Forked from michaellihs/tmux-cheat-sheet.md
Created June 21, 2021 20:46
Show Gist options
  • Save umhan35/7ae497c3d75a28e9d36a88a99bee033f to your computer and use it in GitHub Desktop.
Save umhan35/7ae497c3d75a28e9d36a88a99bee033f to your computer and use it in GitHub Desktop.

Revisions

  1. @michaellihs michaellihs revised this gist Sep 21, 2016. 1 changed file with 22 additions and 12 deletions.
    34 changes: 22 additions & 12 deletions tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -68,20 +68,30 @@ Starting multiple commands in multiple panes
    Start a new tmux session with `tmux` before running the script!

    ``` sh
    #!/bin/bash

    SESSION=$USER

    tmux -2 new-session -d -s $SESSION
    # start a new tmux session and detach from it
    tmux new-session -d -s session1

    tmux rename-window 'my window'
    tmux send-keys 'echo "pane 1"' C-m

    tmux select-window -t session1:0
    tmux split-window -h
    tmux send-keys 'echo "pane 2"' C-m

    tmux new-window -t $SESSION:1 -n "TMUX-Test"
    tmux split-window -h
    tmux select-pane -t 0
    tmux send-keys "echo 'pane1'" C-m
    tmux select-pane -t 1
    tmux send-keys "echo 'pane2'" C-m
    tmux split-window -v
    tmux send-keys "echo 'pane3'" C-m
    tmux send-keys 'echo "pane 3"' C-m

    # we want to have notifications in the status bar, if there are changes in the windows
    tmux setw -g monitor-activity on
    tmux set -g visual-activity on

    tmux select-layout even-horizontal

    # select the first window to be in the foreground
    tmux select-window -t session:1

    # attach our terminal to the tmux session
    tmux -2 attach-session -t cflogs
    ```


  2. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -139,8 +139,10 @@ Further Resources

    * [tmuxinator](https://github.com/tmuxinator/tmuxinator)
    * [tmux shortcuts & cheatsheet](https://gist.github.com/MohamedAlaa/2961058)
    * [tmux tutorial](http://blog.hawkhost.com/2010/06/28/tmux-the-terminal-multiplexer/)
    * [tmux tutorial - part 1](http://blog.hawkhost.com/2010/06/28/tmux-the-terminal-multiplexer/)
    * [tmux tutorial - part 2](http://blog.hawkhost.com/2010/07/02/tmux-%E2%80%93-the-terminal-multiplexer-part-2/)
    * [Mouse support in OS X](http://www.davidverhasselt.com/enable-mouse-support-in-tmux-on-os-x/)
    * [(Video) Basic tmux Tutorial - Windows, Panes, and Sessions over SSH tutoriaLinux - Part 1](https://www.youtube.com/watch?v=BHhA_ZKjyxo)
    * [(Video) Basic tmux Tutorial, Part 2 -- Shared Sessions](https://www.youtube.com/watch?v=norO25P7xHg)
    * [tmux scripting - blog post](http://blog.htbaa.com/news/tmux-scripting)

  3. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -141,5 +141,6 @@ Further Resources
    * [tmux shortcuts & cheatsheet](https://gist.github.com/MohamedAlaa/2961058)
    * [tmux tutorial](http://blog.hawkhost.com/2010/06/28/tmux-the-terminal-multiplexer/)
    * [Mouse support in OS X](http://www.davidverhasselt.com/enable-mouse-support-in-tmux-on-os-x/)
    * [(Video) Basic tmux Tutorial - Windows, Panes, and Sessions over SSH tutoriaLinux](https://www.youtube.com/watch?v=BHhA_ZKjyxo)
    * [(Video) Basic tmux Tutorial - Windows, Panes, and Sessions over SSH tutoriaLinux - Part 1](https://www.youtube.com/watch?v=BHhA_ZKjyxo)
    * [(Video) Basic tmux Tutorial, Part 2 -- Shared Sessions](https://www.youtube.com/watch?v=norO25P7xHg)

  4. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -3,9 +3,11 @@ tmux Cheat Sheet

    **Table of Contents**

    * [General Usage](#general-usage)
    * [Shortcuts](#shortcuts)
    * [Scripting TMUX](#scripting-tmux)
    * [Configuring TMUX](#configuring-tmux)
    * [Commands](#commands)
    * [Scripting tmux](#scripting-tmux)
    * [Configuring tmux](#configuring-tmux)
    * [Further Resources](#further-resources)


  5. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -43,6 +43,18 @@ Shortcuts
    || go to left pane |
    || go to upper pane |
    || go to lower pane |
    | | **Working with Sessions** |
    | `d` | detach from session |


    Commands
    ========

    | Command | Description |
    | ------- | ----------- |
    | tmux -s <SESSION NAME> | creates a new session with name `<SESSION NAME>` |
    | tmux list-sessions | lists all currently running tmux sessions |
    | tmux attach -t <SESSION NAME> | attach to the session called `<SESSION NAME>` |


    Scripting TMUX
  6. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -38,7 +38,7 @@ Shortcuts
    | `w` | list windows (and then select with arrow keys) |
    | | **Working with Panes** |
    | `%` | split window vertically |
    | `-` | split window horizontally |
    | `-` | split window horizontally <br> requires `bind - split-window -v` in our `.tmux.conf` |
    || go to right pane |
    || go to left pane |
    || go to upper pane |
  7. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -28,6 +28,7 @@ Shortcuts
    | :-----: | ----------- |
    | `CTRL`+`b` `<command>` | sends `<command>` to tmux instead of sending it to the shell |
    | | **General Commands** |
    | `?` | shows a list of all commands (`q`closes the list) |
    | `:` | enter a tmux command |
    | | **Working with Windows** |
    | `c` | creates a new window |
  8. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -87,7 +87,11 @@ Use
    set -g prefix C-a
    ```

    to change the default prefix from `CTRL` + `b` to `CTRL` + `a`
    to change the default prefix from `CTRL` + `b` to `CTRL` + `a`. Optionally you can "free" the default binding with

    ``` sh
    unbind C-b
    ```


    Key Bindings
  9. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -78,6 +78,18 @@ You can configure tmux via the `~/.tmux.conf` file. After making changes to the
    tmux source ~/.tmux.conf


    Changing the default prefix
    ---------------------------

    Use

    ``` sh
    set -g prefix C-a
    ```

    to change the default prefix from `CTRL` + `b` to `CTRL` + `a`


    Key Bindings
    ------------

  10. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -83,7 +83,11 @@ Key Bindings

    You can add / alter tmux's key bindings with the following command


    ``` sh
    bind | split-window -h
    ```

    this binds the `split window -h` command to the `|` key.


    Adding Mouse Support for Mac OS X
  11. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 22 additions and 0 deletions.
    22 changes: 22 additions & 0 deletions tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -9,12 +9,26 @@ tmux Cheat Sheet
    * [Further Resources](#further-resources)


    General Usage
    =============

    * Start a tmux session with

    ``` sh
    tmux
    ```

    * Select text in a tmux window with your mouse by holding the `SHIFT` key (Windows) or the `OPTIONS` key (Mac) and then using the mouse as you'd normally do


    Shortcuts
    =========

    | Key(s) | Description |
    | :-----: | ----------- |
    | `CTRL`+`b` `<command>` | sends `<command>` to tmux instead of sending it to the shell |
    | | **General Commands** |
    | `:` | enter a tmux command |
    | | **Working with Windows** |
    | `c` | creates a new window |
    | `,` | rename current window |
    @@ -64,6 +78,14 @@ You can configure tmux via the `~/.tmux.conf` file. After making changes to the
    tmux source ~/.tmux.conf


    Key Bindings
    ------------

    You can add / alter tmux's key bindings with the following command




    Adding Mouse Support for Mac OS X
    ---------------------------------

  12. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 8 additions and 2 deletions.
    10 changes: 8 additions & 2 deletions tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -15,9 +15,15 @@ Shortcuts
    | Key(s) | Description |
    | :-----: | ----------- |
    | `CTRL`+`b` `<command>` | sends `<command>` to tmux instead of sending it to the shell |
    | | **Working with Windows** |
    | `c` | creates a new window |
    | `,` | rename current window |
    | `p` | switch to previous window |
    | `n` | switch to next window |
    | `w` | list windows (and then select with arrow keys) |
    | | **Working with Panes** |
    | % | split window vertically |
    | - | split window horizontally |
    | `%` | split window vertically |
    | `-` | split window horizontally |
    || go to right pane |
    || go to left pane |
    || go to upper pane |
  13. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ Shortcuts

    | Key(s) | Description |
    | :-----: | ----------- |
    | `CTRL`+`b` | `send-prefix` this is like entering the control mode, you can now use the key(s) described below to do things |
    | `CTRL`+`b` `<command>` | sends `<command>` to tmux instead of sending it to the shell |
    | | **Working with Panes** |
    | % | split window vertically |
    | - | split window horizontally |
  14. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -78,3 +78,5 @@ Further Resources
    * [tmux shortcuts & cheatsheet](https://gist.github.com/MohamedAlaa/2961058)
    * [tmux tutorial](http://blog.hawkhost.com/2010/06/28/tmux-the-terminal-multiplexer/)
    * [Mouse support in OS X](http://www.davidverhasselt.com/enable-mouse-support-in-tmux-on-os-x/)
    * [(Video) Basic tmux Tutorial - Windows, Panes, and Sessions over SSH tutoriaLinux](https://www.youtube.com/watch?v=BHhA_ZKjyxo)

  15. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 16 additions and 4 deletions.
    20 changes: 16 additions & 4 deletions tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -30,11 +30,23 @@ Scripting TMUX
    Starting multiple commands in multiple panes
    --------------------------------------------

    Start a new tmux session with `tmux` before running the script!

    ``` sh
    tmux new-session -d 'command_1'
    tmux split-window -v 'command_2'
    tmux split-window -h 'command_3'
    tmux -2 attach-session -d
    #!/bin/bash

    SESSION=$USER

    tmux -2 new-session -d -s $SESSION

    tmux new-window -t $SESSION:1 -n "TMUX-Test"
    tmux split-window -h
    tmux select-pane -t 0
    tmux send-keys "echo 'pane1'" C-m
    tmux select-pane -t 1
    tmux send-keys "echo 'pane2'" C-m
    tmux split-window -v
    tmux send-keys "echo 'pane3'" C-m
    ```


  16. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -16,6 +16,8 @@ Shortcuts
    | :-----: | ----------- |
    | `CTRL`+`b` | `send-prefix` this is like entering the control mode, you can now use the key(s) described below to do things |
    | | **Working with Panes** |
    | % | split window vertically |
    | - | split window horizontally |
    || go to right pane |
    || go to left pane |
    || go to upper pane |
  17. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ Shortcuts
    =========

    | Key(s) | Description |
    | ------- | ----------- |
    | :-----: | ----------- |
    | `CTRL`+`b` | `send-prefix` this is like entering the control mode, you can now use the key(s) described below to do things |
    | | **Working with Panes** |
    || go to right pane |
  18. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ Shortcuts
    | Key(s) | Description |
    | ------- | ----------- |
    | `CTRL`+`b` | `send-prefix` this is like entering the control mode, you can now use the key(s) described below to do things |
    | Working with Panes |
    | | **Working with Panes** |
    || go to right pane |
    || go to left pane |
    || go to upper pane |
  19. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -15,6 +15,7 @@ Shortcuts
    | Key(s) | Description |
    | ------- | ----------- |
    | `CTRL`+`b` | `send-prefix` this is like entering the control mode, you can now use the key(s) described below to do things |
    | Working with Panes |
    || go to right pane |
    || go to left pane |
    || go to upper pane |
  20. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 17 additions and 0 deletions.
    17 changes: 17 additions & 0 deletions tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -38,6 +38,23 @@ tmux -2 attach-session -d
    Configuring TMUX
    ================

    You can configure tmux via the `~/.tmux.conf` file. After making changes to the config file, you can update the configuration "on-the-fly" with

    tmux source ~/.tmux.conf


    Adding Mouse Support for Mac OS X
    ---------------------------------

    In order to have mouse support in Mac OS X, you can add the following lines to your config file:

    ``` sh
    set -g mode-mouse on
    set -g mouse-resize-pane on
    set -g mouse-select-pane on
    set -g mouse-select-window on
    ```


    Further Resources
    =================
  21. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -3,10 +3,10 @@ tmux Cheat Sheet

    **Table of Contents**

    [Shortcuts](#shortcuts)<br>
    [Scripting TMUX](#scripting-tmux)<br>
    [Configuring TMUX](#configuring-tmux)<br>
    [Further Resources](#further-resources)
    * [Shortcuts](#shortcuts)
    * [Scripting TMUX](#scripting-tmux)
    * [Configuring TMUX](#configuring-tmux)
    * [Further Resources](#further-resources)


    Shortcuts
  22. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 4 additions and 7 deletions.
    11 changes: 4 additions & 7 deletions tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,11 @@
    tmux Cheat Sheet
    ================

    *Table of Contents*

    [Shortcuts](#shortcuts)

    [Scripting TMUX](#scripting-tmux)

    [Configuring TMUX](#configuring-tmux)
    **Table of Contents**

    [Shortcuts](#shortcuts)<br>
    [Scripting TMUX](#scripting-tmux)<br>
    [Configuring TMUX](#configuring-tmux)<br>
    [Further Resources](#further-resources)


  23. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -4,8 +4,11 @@ tmux Cheat Sheet
    *Table of Contents*

    [Shortcuts](#shortcuts)

    [Scripting TMUX](#scripting-tmux)

    [Configuring TMUX](#configuring-tmux)

    [Further Resources](#further-resources)


  24. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 16 additions and 0 deletions.
    16 changes: 16 additions & 0 deletions tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,14 @@
    tmux Cheat Sheet
    ================

    *Table of Contents*

    [Shortcuts](#shortcuts)
    [Scripting TMUX](#scripting-tmux)
    [Configuring TMUX](#configuring-tmux)
    [Further Resources](#further-resources)


    Shortcuts
    =========

    @@ -13,6 +21,9 @@ Shortcuts
    || go to lower pane |


    Scripting TMUX
    ==============

    Starting multiple commands in multiple panes
    --------------------------------------------

    @@ -24,9 +35,14 @@ tmux -2 attach-session -d
    ```


    Configuring TMUX
    ================


    Further Resources
    =================

    * [tmuxinator](https://github.com/tmuxinator/tmuxinator)
    * [tmux shortcuts & cheatsheet](https://gist.github.com/MohamedAlaa/2961058)
    * [tmux tutorial](http://blog.hawkhost.com/2010/06/28/tmux-the-terminal-multiplexer/)
    * [Mouse support in OS X](http://www.davidverhasselt.com/enable-mouse-support-in-tmux-on-os-x/)
  25. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,10 @@ Shortcuts
    | Key(s) | Description |
    | ------- | ----------- |
    | `CTRL`+`b` | `send-prefix` this is like entering the control mode, you can now use the key(s) described below to do things |
    || go to right pane |
    || go to left pane |
    || go to upper pane |
    || go to lower pane |


    Starting multiple commands in multiple panes
  26. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -4,9 +4,9 @@ tmux Cheat Sheet
    Shortcuts
    =========

    Key(s) | Description
    --------------------
    `CTRL`+`b` | `send-prefix` this is like entering the control mode, you can now use the key(s) described below to do things
    | Key(s) | Description |
    | ------- | ----------- |
    | `CTRL`+`b` | `send-prefix` this is like entering the control mode, you can now use the key(s) described below to do things |


    Starting multiple commands in multiple panes
  27. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,14 @@
    tmux Cheat Sheet
    ================

    Shortcuts
    =========

    Key(s) | Description
    --------------------
    `CTRL`+`b` | `send-prefix` this is like entering the control mode, you can now use the key(s) described below to do things


    Starting multiple commands in multiple panes
    --------------------------------------------

  28. @michaellihs michaellihs revised this gist Sep 17, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -17,3 +17,4 @@ Further Resources

    * [tmuxinator](https://github.com/tmuxinator/tmuxinator)
    * [tmux shortcuts & cheatsheet](https://gist.github.com/MohamedAlaa/2961058)
    * [tmux tutorial](http://blog.hawkhost.com/2010/06/28/tmux-the-terminal-multiplexer/)
  29. @michaellihs michaellihs revised this gist Sep 16, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -16,4 +16,4 @@ Further Resources
    =================

    * [tmuxinator](https://github.com/tmuxinator/tmuxinator)
    * [tmux Cheat Sheet](https://gist.github.com/MohamedAlaa/2961058)
    * [tmux shortcuts & cheatsheet](https://gist.github.com/MohamedAlaa/2961058)
  30. @michaellihs michaellihs revised this gist Sep 16, 2016. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions tmux-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -4,16 +4,16 @@ tmux Cheat Sheet
    Starting multiple commands in multiple panes
    --------------------------------------------

    ```` sh
    ``` sh
    tmux new-session -d 'command_1'
    tmux split-window -v 'command_2'
    tmux split-window -h 'command_3'
    tmux -2 attach-session -d

    ````
    ```


    Further Resources
    =================

    * [tmuxinator](https://github.com/tmuxinator/tmuxinator)
    * [tmux Cheat Sheet](https://gist.github.com/MohamedAlaa/2961058)