Quick Shell Access from Claude Code
Source: Dev.to
Running Single Commands
When you need to execute a quick command—such as checking the git status, switching branches, or running tests—you can use the ! prefix directly in Claude Code.
!git status
!python -m pytest
- The command runs inline without leaving your Claude session.
- Ideal for one‑off checks.
- Each command must be prefixed with
!; there’s no persistent “bash mode,” so you need to remember the prefix each time.
Suspending Claude Code
For more involved shell work, suspend Claude Code entirely and drop into your regular shell.
- Press
Ctrl+Zto suspend the Claude client process. - You’ll be returned to your full shell prompt, where you can run any commands (e.g., extensive git branch management) without consuming Claude tokens or network round‑trips.
- When you’re finished, type
fgto resume Claude Code exactly where you left off.
Caveat: Only suspend when Claude is idle and waiting for your next message. If you press Ctrl+Z while Claude is generating a response, the server‑side generation continues while your client is frozen. Resuming with fg may cause the client and server to become out of sync, potentially losing the response or corrupting the session state.