Claude Corner
Claude Started Your Dev Server and the Turn Just Sat There? Press Ctrl+B and Keep Working.
By Steven Sorensen · 20 Oct 2026

At a glance
Ctrl+Bmoves a running command, likenpm run devor a watch build, to the background so Claude can take your next prompt.- Asking Claude up front to run a command in the background skips the wait, and Claude can still read the server's output when something breaks.
/taskslists the background work in your session and lets you stop it, so a forgotten server does not keep holding your port.
You ask Claude to start the dev server and then fix the login form. It runs npm run dev, the server prints that it is ready and keeps running, because dev servers do not exit on their own. Claude is now waiting on a command that will not finish before its timeout. You stare at a spinner, or you press Esc and start over. Claude Code has a cleaner way out, and it is one key.
Why it matters
The tools reference says a foreground command runs under a timeout, and the default, set by BASH_DEFAULT_TIMEOUT_MS, is two minutes out of the box. When a foreground command reaches its timeout without finishing, Claude Code moves it to the background instead of stopping it. Our reading: with that default, a dev server Claude starts in the foreground costs you about two minutes of waiting per start, and it ends up in the background anyway. Claude can ask for a longer timeout on a single command, so the wait can be longer than that.
Backgrounding on purpose gets you there right away. The command keeps running, its output goes to a file Claude can read, and Claude answers new prompts while it runs. The docs list build tools, test runners, dev servers and long-running processes such as Docker as common candidates. Our suggestion: do not let a long-running command sit in the foreground. Background it the moment it starts.
How to run long commands in the background
- Ask for it in the prompt. The interactive mode docs list prompting Claude Code to run a command in the background as the first way in. Claude starts the command as a background task and keeps working.
- Already stuck? While Claude's command is running, press
Ctrl+B. It moves the running Bash command to the background. In tmux, pressCtrl+Btwice, because tmux uses it as its prefix key. - Running it yourself? Type
!and then the command to use shell mode, for example! npm run dev. Shell mode supports the sameCtrl+Bbackgrounding, and it adds the command and its output to the conversation context. - When the page breaks, ask Claude to check the server output. Background output is written to a file, and Claude reads it with the Read tool, so you do not have to paste logs.
- Run
/tasksto view and manage background work in the session, including subagents, and to stop a server you no longer need./bashesopens the same view.
# typed at the Claude Code prompt
Start the dev server with npm run dev in the background, then fix the login form.
# a command is already running and blocking the turn
Ctrl+B # move it to the background (press twice inside tmux)
# run it yourself, no Claude turn needed to start it
! npm run dev # shell mode; Ctrl+B backgrounds this too
/tasks # list and stop background shells and subagents
Gotchas
- Exiting stops it. Background tasks are cleaned up when Claude Code exits, so quitting the session stops your server. If you background the whole session instead of exiting, its tasks keep running there.
- A
cddoes not stick. For a command that moved to the background, the tools reference says the session's working directory stays where it was, so do not expect Claude's next command to run in the server's folder. - Subagents end their commands. A background command that a foreground subagent started ends when that subagent's run ends. Start long-lived servers from the main conversation.
- Headless runs have a limit. In a terminal, the desktop app or the VS Code extension, background commands have no time limit. In unattended runs such as
claude -por a cloud session, they do, so do not count on a server outliving a headless job. - Backgrounding can be off. If
Ctrl+Bdoes nothing, check whetherCLAUDE_CODE_DISABLE_BACKGROUND_TASKSis set to1or you started in bare mode. Either one turns off backgrounding, including the shortcut, and a command that hits its timeout then stops instead.
Recommended AI prompt
Copy this paragraph into ChatGPT, Claude, Gemini, Grok, or whatever AI you use.
I use Claude Code in a terminal and my dev server keeps blocking Claude's turns. Ask me which commands I run during a normal session, such as a dev server, a watch build, tests or Docker, whether I work inside tmux, and whether I ever use claude -p or subagents. Then give me a short routine for starting each one in the background, checking its output when something fails, stopping it with /tasks, and spotting the setting that would turn backgrounding off. Link me to the official Claude Code interactive mode and tools reference docs instead of guessing key names.