# BASH_MAX_OUTPUT_LENGTH

> It sets how much of a command's output Claude gets back.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** BASH_MAX_OUTPUT_LENGTH environment variable, TASK_MAX_OUTPUT_LENGTH

## Think of it like

It is like you copy just the first part of a long note.

## Definition

BASH_MAX_OUTPUT_LENGTH sets how many characters of a shell command's output Claude gets back. The default is 30,000, and the most you can set is 150,000. If the bashOutputMaxChars setting is set, this one is ignored. The old TASK_MAX_OUTPUT_LENGTH does nothing now.

## Example

Lucy's test run prints a long log, and the failure is near the end. She raises the limit, and Claude can see the error.

## Example code

```bash
export BASH_MAX_OUTPUT_LENGTH=80000
claude
```

Show Claude more of each command's output.

## Why it matters

If the useful line is past the cut, Claude never sees it and guesses instead.

## Common mistake

Raising it when a filter would do. Piping the output through grep or tail is cheaper.

## Three principles

- **Default 30,000.** Characters.
- **Most 150,000.** The top.
- **Setting wins.** bashOutputMaxChars.

## Related terms

- [Bash Tool](https://learn.benibix.com/term/ai/bash-tool)
- [BASH_DEFAULT_TIMEOUT_MS](https://learn.benibix.com/term/ai/bash-default-timeout-ms-variable)
- [CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS](https://learn.benibix.com/term/ai/claude-code-file-read-max-output-tokens-variable)

![Each tool has its own cap on how much of its output Claude gets to read.](https://learn.benibix.com/diagrams/env-output-caps.svg)

---

Source: https://learn.benibix.com/term/ai/bash-max-output-length-variable
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-16
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
