Skip to content

Instantly share code, notes, and snippets.

@billibala
Created January 16, 2026 08:16
Show Gist options
  • Select an option

  • Save billibala/18cfb99fde300516b5bbf90e3b2a45f4 to your computer and use it in GitHub Desktop.

Select an option

Save billibala/18cfb99fde300516b5bbf90e3b2a45f4 to your computer and use it in GitHub Desktop.
Tmux cheatsheet generated by gemini

Since you are a "new user" but already have a custom configuration, you essentially have two different "languages" to speak with tmux.

  1. Shortcuts (The Hotkeys): Fast, everyday actions (like splitting or switching) using your Prefix: Ctrl + a.
  2. Commands (The CLI): Formal instructions typed into the status bar or your terminal (like rename-session or kill-pane).

Here is your tailored cheatsheet for a workflow involving Emacs and Coding Agents.


1. Shortcut Cheatsheet (Ctrl + a + Key)

Remember: Since you use Emacs, if you need to go to the start of a line inside Emacs, press Ctrl + a twice.

Workspace Management

Shortcut Action Agent/Emacs Context
c New Window Create a fresh space for a new task.
, Rename Window Label it "Agent-Run" or "Logs."
0 - 9 Switch Window Jump between code and agent output.
d Detach Crucial: Keeps your agent running while you log out.

Tiling & Pane Control (The "Grid")

Shortcut Action Agent/Emacs Context
" Split Horizontal Put the agent below your code.
% Split Vertical Put the agent to the side of your code.
o Rotate Focus Quickly jump between your code and the agent.
z Zoom Toggle Make the agent full-screen to read a long trace.
Space Cycle Layout Automatically tile your panes into a grid.
x Kill Pane Use this to close the "frozen" panes from remain-on-exit.

Scrolling & History (Copy Mode)

Shortcut Action Agent/Emacs Context
[ Enter Copy Mode Stop the auto-scroll to read agent output.
PageUp/Dn Scroll Browse through the agent's history.
/ Search Find "Error" or "Exception" in the logs.
q Exit Copy Mode Return to the live prompt.

2. Command Cheatsheet (The : Menu)

Access these by pressing Ctrl + a then :. A prompt will appear at the bottom.

Session & Environment

Command Action
rename-session <name> Change the name of your current project container.
source-file ~/.tmux.conf Reload your config after you make changes.
kill-session Completely shut down everything (all windows/agents).

Specialized Management

Command Action
set synchronize-panes Type in one pane, it appears in all. (Your y key does this too!).
break-pane Take the current pane and turn it into its own full Window.
join-pane -t :1 Pull a pane from Window 1 into your current Window.
capture-pane -S -100 Capture the last 100 lines of output (good for debugging).

3. Terminal Commands (Outside Tmux)

Run these from your standard shell prompt to manage your sessions.

Command Action
tmux Start a new session.
tmux ls List all running sessions (see if your agent is still alive).
tmux attach -t 0 Reconnect to your agent session (0 is your default).
tmux kill-server The "Nuke" option: kills every tmux session and agent.

Pro-Tip for Coding Agents

Since you have remain-on-exit on, your panes won't disappear when an agent finishes. If your screen gets cluttered with "dead" panes, use this command in the : menu:

respawn-pane — This restarts the command in that pane without you having to close and recreate the split.

Would you like me to create a "startup script" for you that automatically opens your Emacs window and a tiled Agent window every time you boot up?

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