claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Ctrl+B background command not working in interactive mode

Open wangkanai opened this issue 8 months ago • 13 comments

Issue Summary

The Ctrl+B keyboard shortcut for running background commands is not functional in Claude Code interactive mode across multiple terminal environments.

Environment Details

System Information:

  • OS: macOS 14.6.0 (Darwin 24.6.0)
  • Claude Code: Interactive CLI mode
  • Terminals Tested:
    • Tabby terminal
    • macOS standard Terminal.app
  • Shell: zsh (/bin/zsh)

Problem Description

When attempting to use Ctrl+B to run commands in the background, the functionality does not work. Commands run normally (foreground) instead of being executed in the background.

Steps to Reproduce

  1. Open Claude Code in interactive mode
  2. Type a long-running command: sleep 5 && echo "Background task completed"
  3. Press Ctrl+B (instead of Enter)
  4. Expected: Command runs in background, can continue conversation
  5. Actual: Command runs in foreground, blocks interaction

Configuration Attempts

Attempted to resolve potential key binding conflicts by modifying shell configurations:

~/.zshrc:

bindkey '^B' beep
unset "key[^B]"

~/.config/powershell/Microsoft.PowerShell_profile.ps1:

Remove-PSReadLineKeyHandler -Key Ctrl+B

After reloading configurations (source ~/.zshrc), bindkey | grep "^B" returns no results, confirming the binding was removed.

Current Workaround

Using standard background syntax works correctly:

sleep 5 && echo "Background task completed" &

Documentation Status

The Ctrl+B background command feature is not documented in the official Claude Code interactive mode documentation at: https://docs.anthropic.com/en/docs/claude-code/interactive-mode

Impact

This prevents users from running long-running commands in the background while continuing to interact with Claude Code, reducing productivity in development workflows.

Request

Please clarify if:

  1. Ctrl+B background commands are an intended feature
  2. Additional configuration is required
  3. This is a known limitation or bug

Thank you for investigating this issue!

wangkanai avatar Aug 12 '25 21:08 wangkanai

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/5376
  2. https://github.com/anthropics/claude-code/issues/5378
  3. https://github.com/anthropics/claude-code/issues/5534

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Aug 12 '25 21:08 github-actions[bot]

No other issue has been solved yet. We need a work around to this issue

wangkanai avatar Aug 12 '25 21:08 wangkanai

Try Shift+Ctrl+B

trevorprater avatar Aug 12 '25 23:08 trevorprater

@trevorprater Nothing happened, ah!

wangkanai avatar Aug 13 '25 05:08 wangkanai

Aw, sorry, it worked for me.

trevorprater avatar Aug 13 '25 05:08 trevorprater

I don't know what the release of 1.80 do we have a fix on this issue?

wangkanai avatar Aug 15 '25 04:08 wangkanai

@claude, any update on this issue, as now we have release 1.98 already.

wangkanai avatar Aug 31 '25 08:08 wangkanai

Also would like this to work.. I tried all above solutions and still not working.

Georgelstone avatar Aug 31 '25 13:08 Georgelstone

Platform: macOS 15.6.1 App: Ghostty Claude Code Version: 1.0.120

Confirming this issue persists. Neither Ctrl+B nor Shift+Ctrl+B work to background commands on macOS.

Tested:

  • Ctrl+B: No effect
  • Shift+Ctrl+B: No effect

Current workaround: Appending & to commands works: sleep 30 &

Would appreciate either:

  1. Configurable keybindings in settings
  2. Alternative default like Cmd+B for macOS
  3. Official documentation of the & workaround until fixed

This significantly impacts workflow when running dev servers or long-running processes.

jsulopzs avatar Sep 22 '25 16:09 jsulopzs

doesn't work on Windows either (powershell, Windows Terminal, claude code version 2.0.1)

nikitakot avatar Sep 30 '25 10:09 nikitakot

Claude code suggest me solution for iterm2. It works for me:

  1. Open iTerm2 → Settings (⌘,)
  2. Navigate to: Profiles → Keys → Key Mappings
  3. Click the "+" button to add a new mapping
  4. Press: Ctrl+B when prompted
  5. Set Action to: "Send Hex Code"
  6. Enter hex code: 0x02
  7. Click OK

trmquang93 avatar Oct 06 '25 23:10 trmquang93

Since this issue was published (or maybe when it was published as well), the ctrl+b command is documented in interactive mode: https://docs.claude.com/en/docs/claude-code/interactive-mode#how-backgrounding-works. It's not listed in the general controls table (and maybe should be added there) https://docs.claude.com/en/docs/claude-code/interactive-mode#general-controls

TyceHerrman avatar Oct 13 '25 20:10 TyceHerrman

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 07 '25 10:12 github-actions[bot]