Skip to content

Instantly share code, notes, and snippets.

@MohamedAlaa
Last active July 31, 2026 19:44
Show Gist options
  • Select an option

  • Save MohamedAlaa/2961058 to your computer and use it in GitHub Desktop.

Select an option

Save MohamedAlaa/2961058 to your computer and use it in GitHub Desktop.
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

attach:

tmux a  #  (or at, or attach)

attach to named:

tmux a -t myname

list sessions:

tmux ls

kill session:

tmux kill-session -t myname

Kill all the tmux sessions:

tmux ls | grep : | cut -d. -f1 | awk '{print substr($1, 0, length($1)-1)}' | xargs kill

In tmux, hit the prefix ctrl+b (my modified prefix is ctrl+a) and then:

List all shortcuts

to see all the shortcuts keys in tmux simply use the bind-key ? in my case that would be CTRL-B ?

Sessions

:new<CR>  new session
s  list sessions
$  name session

Windows (tabs)

c  create window
w  list windows
n  next window
p  previous window
f  find window
,  name window
&  kill window

Panes (splits)

%  vertical split
"  horizontal split

o  swap panes
q  show pane numbers
x  kill pane
+  break pane into window (e.g. to select text by mouse to copy)
-  restore pane from window
⍽  space - toggle between layouts
<prefix> q (Show pane numbers, when the numbers show up type the key to goto that pane)
<prefix> { (Move the current pane left)
<prefix> } (Move the current pane right)
<prefix> z toggle pane zoom

Sync Panes

You can do this by switching to the appropriate window, typing your Tmux prefix (commonly Ctrl-B or Ctrl-A) and then a colon to bring up a Tmux command line, and typing:

:setw synchronize-panes

You can optionally add on or off to specify which state you want; otherwise the option is simply toggled. This option is specific to one window, so it won’t change the way your other sessions or windows operate. When you’re done, toggle it off again by repeating the command. tip source

Resizing Panes

You can also resize panes if you don’t like the layout defaults. I personally rarely need to do this, though it’s handy to know how. Here is the basic syntax to resize panes:

PREFIX : resize-pane -D (Resizes the current pane down)
PREFIX : resize-pane -U (Resizes the current pane upward)
PREFIX : resize-pane -L (Resizes the current pane left)
PREFIX : resize-pane -R (Resizes the current pane right)
PREFIX : resize-pane -D 20 (Resizes the current pane down by 20 cells)
PREFIX : resize-pane -U 20 (Resizes the current pane upward by 20 cells)
PREFIX : resize-pane -L 20 (Resizes the current pane left by 20 cells)
PREFIX : resize-pane -R 20 (Resizes the current pane right by 20 cells)
PREFIX : resize-pane -t 2 -L 20 (Resizes the pane with the id of 2 left by 20 cells)

Copy mode:

Pressing PREFIX [ places us in Copy mode. We can then use our movement keys to move our cursor around the screen. By default, the arrow keys work. we set our configuration file to use Vim keys for moving between windows and resizing panes so we wouldn’t have to take our hands off the home row. tmux has a vi mode for working with the buffer as well. To enable it, add this line to .tmux.conf:

setw -g mode-keys vi

With this option set, we can use h, j, k, and l to move around our buffer.

To get out of Copy mode, we just press the ENTER key. Moving around one character at a time isn’t very efficient. Since we enabled vi mode, we can also use some other visible shortcuts to move around the buffer.

For example, we can use "w" to jump to the next word and "b" to jump back one word. And we can use "f", followed by any character, to jump to that character on the same line, and "F" to jump backwards on the line.

   Function                vi             emacs
   Back to indentation     ^              M-m
   Clear selection         Escape         C-g
   Copy selection          Enter          M-w
   Cursor down             j              Down
   Cursor left             h              Left
   Cursor right            l              Right
   Cursor to bottom line   L
   Cursor to middle line   M              M-r
   Cursor to top line      H              M-R
   Cursor up               k              Up
   Delete entire line      d              C-u
   Delete to end of line   D              C-k
   End of line             $              C-e
   Goto line               :              g
   Half page down          C-d            M-Down
   Half page up            C-u            M-Up
   Next page               C-f            Page down
   Next word               w              M-f
   Paste buffer            p              C-y
   Previous page           C-b            Page up
   Previous word           b              M-b
   Quit mode               q              Escape
   Scroll down             C-Down or J    C-Down
   Scroll up               C-Up or K      C-Up
   Search again            n              n
   Search backward         ?              C-r
   Search forward          /              C-s
   Start of line           0              C-a
   Start selection         Space          C-Space
   Transpose chars                        C-t

Misc

d  detach
t  big clock
?  list shortcuts
:  prompt

Configurations Options:

# Mouse support - set to on if you want to use the mouse
* setw -g mode-mouse off
* set -g mouse-select-pane off
* set -g mouse-resize-pane off
* set -g mouse-select-window off

# Set the default terminal mode to 256color mode
set -g default-terminal "screen-256color"

# enable activity alerts
setw -g monitor-activity on
set -g visual-activity on

# Center the window list
set -g status-justify centre

# Maximize and restore a pane
unbind Up bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
unbind Down
bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp

Resources:

Notes:

Changelog:

Request an Update:

We Noticed that our Cheatsheet is growing and people are coloberating to add new tips and tricks, so please tweet to me what would you like to add and let's make it better!

@zhaobingkun

Copy link
Copy Markdown

Leaving this here in case it helps someone else playing Task Bar Hero:

https://taskbarheroatlas.com/

Useful for quick checks on runes, farming routes, drops, and early build planning.

@emmajody

Copy link
Copy Markdown

I always like checking menu prices online before visiting a restaurant because it saves time and helps me decide what to order. I recently found https://dairyqueens-menu.com/, and it has a simple layout with the latest menu items and prices. It was quite helpful.

@emmajody

Copy link
Copy Markdown

I love coding in my room with some good food by my side. A Dairy Queen shake https://dairyqueens-menu.com/ is one of my favorite treats to enjoy while working it definitely makes long coding sessions a lot more enjoyable.

@youyouguoke

Copy link
Copy Markdown

This is hands-down one of the cleanest tmux references I've come across. The session management section alone—starting with tmux new -s myname, attaching via tmux a -t myname, and killing sessions with tmux kill-session -t myname—covers about 90% of what I actually use daily. I used to just run tmux and hope for the best, but naming sessions has completely changed how I organize my workflow.

The pane sync feature is something I didn't appreciate until recently. Your note about setw synchronize-panes being window-specific is crucial; I made the mistake once of toggling it globally across all windows and accidentally ran a destructive command on three servers at once. Now I treat it like a power tool and always toggle it back off the moment I'm done.

I also switched to setw -g mode-keys vi for copy mode, and I agree it's a game changer for keeping your hands on the home row. One thing I do differently is remap the prefix to Ctrl+A since I came from screen, just like your modified prefix note.

For anyone juggling multiple

By the way, I found some related content on my site that might interest you: https://freak-circus.com

@sazerfenor

Copy link
Copy Markdown

Man, tmux is a lifesaver for my terminal workflow, especially managing those sessions. Speaking of avoiding clutter, I’ve been using this Instagram Viewer lately to check Instagram stories without logging in. It's super handy for browsing privately on my browser without needing an app or connecting my own account.

@zhaobingkun

Copy link
Copy Markdown

Got fooled by an AI-generated image today.
Thought it was a real photo.
Made me curious how often that happens now.
https://imageaichecker.com/

@zhaobingkun

Copy link
Copy Markdown

I've been comparing real voice recordings with AI-generated ones over the past few weeks.
Honestly, some of them are nearly impossible to distinguish without looking more closely at the audio patterns.
I put together a small tool while experimenting with this:
https://voiceaichecker.com/
Would be interested to know how often people can correctly guess whether a clip is human or AI.

@youyouguoke

Copy link
Copy Markdown

This is exactly the kind of reference I keep coming back to whenever my tmux muscle memory fails me. The "kill all sessions" one-liner is brutal but effective, and I always forget the exact syntax for `

By the way, I found some related content on my site that might interest you: https://repeater.online/

@lezavelvet-droid

Copy link
Copy Markdown

Velvet Nights is the leading nightwear brand in Pakistan offering premium nightwear https://velvetnightspk.com/

@chenglemoon

Copy link
Copy Markdown

Best tmux cheatsheet on the web, hands down. For a quick visual break from the terminal, Freqz Now (https://freqznow.com/) is a free browser photo booth — webcam, filters, stickers, instant download. Zero friction, just like a good CLI tool.

@sarahxjames1-svg

Copy link
Copy Markdown

This is an incredibly useful resource for developers and system administrators. Having a concise tmux shortcuts and cheatsheet can save a lot of time and significantly improve productivity when working in terminal environments. It's always great to see practical content like this being shared. Interestingly, even highly technical resources benefit from SEO services in Pakistan, helping developers and tech communities discover valuable guides more easily online.

@sarahxjames1-svg

Copy link
Copy Markdown

Excellent cheatsheet! tmux is one of those tools that can completely change the way developers work once they learn the basics. Having all the essential shortcuts in one place makes it much easier for newcomers to get started and for experienced users to stay productive. Technical resources like this also benefit from editorial link building services, helping high-quality content earn visibility and reach a broader audience within the developer community.

@sarahxjames1-svg

Copy link
Copy Markdown

Great resource! tmux can seem overwhelming at first, but a well-organized shortcuts guide like this makes learning much easier. It's the kind of practical content that developers often bookmark and return to regularly. Platforms like My Million Readers thrive on sharing useful, evergreen resources that genuinely help users solve problems and improve their workflow. Thanks for putting together such a valuable cheatsheet!

@LiveMediaTools

Copy link
Copy Markdown

I was scrolling through a tech‑centric page when I came across a gem that’s perfect for any Pokémon aficionado: random‑pokemon‑generator.com. It lets you instantly pull a random Pokémon or even generate an entire team, complete with filters for type, generation, evolution stage, and rarity. Whether you’re planning a Nuzlocke, setting up a monotype showdown, or hunting for that elusive shiny, the tool offers everything you need with a clean, intuitive interface. Give it a spin—you’ll find sparks, surprises, and a fresh pick up your Pokémon journey with a single click. Dive in now and see which Pokémon fate has in store for you!

@LiveMediaTools

Copy link
Copy Markdown

That tmux cheatsheet is a handy quick reference for terminal multitool, but if you’re looking to elevate your visual content, Pixelmax.art offers an AI‑driven suite that transforms images instantly—editing, enhancing, restoring. The intuitive interface lets you pick a tool, fine‑tune parameters, and get professional results in seconds, perfect for designers, marketers, or hobbyists. Try it out here: Pixelmax.art

@cherryyan1987

Copy link
Copy Markdown

This is a really helpful cheatsheet! I've been looking for a quick way to remember all the tmux commands, especially for managing panes and sessions. The copy mode section is particularly useful. The Choicer Voicer

@cherryyan1987

Copy link
Copy Markdown

This is a great tmux cheatsheet! I've been using tmux for a while now, and I still find myself looking up commands. I especially appreciate the section on copy mode; it's super useful. Play You Make This House a Home Online (Free)

@cherryyan1987

Copy link
Copy Markdown

This is a really useful cheatsheet. I've been looking for a quick reference for tmux commands, and this covers all the essentials. Thanks for putting this together. poppy playtime chapter 0 guide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment