Skip to content
AstroPaper
Go back

Line Length Conventions in Code: Focus on Bash

Edit page

Common Line Length Standards

Different languages and communities have settled on slightly different maximums:

CharactersUsage
80Traditional standard — Python (PEP 8), Bash, many linters’ default
100Modern practical middle ground
120Google style guides, IntelliJ default, common in Java and Go

For most projects, 80–100 characters strikes a good balance. It keeps code readable in split-pane editors, diffs, and code reviews without excessive wrapping.

Consistency within a project matters more than the exact number — follow whatever the project’s linter or formatter enforces.

Bash: Stick to 80 Characters

Bash scripts have a stronger case for the 80-character limit than most languages:

Line Continuation with \

When commands exceed the limit, use backslash (\) continuation to break them across lines:

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"key": "value"}' \
  "https://example.com/api"

This keeps each flag or argument on its own line, making the command easier to scan and modify.


Edit page
Share this post on:

Previous Post
Managing Daily-Use Scripts with a Dotfiles Repo
Next Post
VS Code Workspace: Setup, Configuration, and Remote SSH