Using tmux with Claude Code
I wrote about how I use tmux previously. My prefix is ctrl-w. Here’s how I use it with Claude Code (and other LLM CLI tools like Codex).
Claude Code Doesn’t Need More Features
I saw someone on GitHub requesting pagination functionality for Claude Code. You don’t need it. If you run Claude Code in tmux, you already have scrolling, paging, and search. No need to add features to Claude Code when tmux already does all of this. Enough with unnecessary features in Claude Code.
This applies to other LLM CLI tools too.
Scrolling with Copy Mode
In tmux, ctrl-w [ enters copy mode. From there:
ctrl-u/ctrl-d— page up/downj/k— line by line/— search forward?— search backwardn/N— next/previous matchctrl-c— exit copy mode
That’s your pagination and search right there.
Capture Buffer to Editor
This lets you copy the entire tmux buffer (aka contents) to your editor:
tmux capture-pane -t 0 -p -S -10000|v
v is my script to trigger Neovim to read STDIN1. The flags:
-t 0— target pane 0-p— print to stdout (instead of to a tmux buffer)-S -10000— capture 10000 lines back
Useful for grabbing logs, script output, or the output from a Claude Code session.
Orchestration and tmux
Claude Code understands tmux. If you mention “tmux 9.0”, it’ll know it’s referring to the current session’s 0th pane in the 9th window. It knows the tmux subcommands to read the pane’s contents, scroll back, issue command, or re-run a command from history.
For example, I have my backend API server running in a tmux window with live reload. When I ask Claude Code to make changes, I can tell it to look at the server output in that window+pane. It can see the errors as they happen and fix them while iterating on a feature.
The difference from using Claude Code’s Bash tool is that I can easily see the full output myself and intervene when needed. It’s more interactive (if I want to).
-
vdoes a few other things with Neovim like opening a file by filename, but that’s not relevant here. ↩