
TL;DR
The colon builtin is the shell's most underrated command - it evaluates arguments, discards results, and unlocks parameter expansion tricks that simplify scripts. HN debate: readable or cryptic?
Filip Roseen published a deep dive on the shell : (colon) builtin that hit 325 points on Hacker News because it scratches an itch every developer knows: shell scripting is indispensable, but its syntax is full of secrets that only reveal themselves after years of use.
The article at refp.se walks through several ways : - the null command that evaluates its arguments and discards the result - can make scripts tighter and more robust:
: "${1:?missing argument, aborting.}" replaces a four-line if-statement with one line that prints a diagnostic and exits with a non-zero status.: "${DOTFILES_PATH:=$HOME/.dotfiles}" sets a variable to a default if it is unset or empty, without triggering any side effect.while :; do ... done is the idiomatic way to write a loop that runs until broken from within.if branch needs a placeholder command, : fills the spot without producing output.: > file truncates a file to zero length (and creates it if it does not exist), though commenters note that a plain > file works the same way without the colon.The thread reveals that the colon goes back to the 1971 Thompson shell, making it one of the oldest surviving builtins in Unix. Its continued relevance is a testament to the shell's design philosophy: compose small, sharp primitives.
The discussion at 137 comments is split between appreciation and concern. The most-upvoted themes:
Readability is the fault line. Multiple top comments argue that every colon trick makes scripts harder to read. "Concise != better" is the recurring counterpoint. One commenter writes: "A language feature that needs marketing is against readability" - implying that if : was truly intuitive, nobody would need an article explaining it. Another says "life is way too short to deal with this nightmare of a language and its 50000 footguns for anything longer than a 2 line script."
The git rebase trick wins universal praise. Commenter fphilipe shared that they use : as the sequence.editor for git interactive rebase, allowing auto-squash rebases without editing the todo list. The alias riq = -c sequence.editor=: rebase --interactive was widely appreciated as a genuinely practical use that most developers had not considered.
Parameter expansion is the real hero. The : "${VAR:?error}" pattern drew the most positive responses. Even critics of the article's one-liner style acknowledged that parameter expansion with :? is a legitimate readability and safety gain. Commenter olexsmir shared a real use in dotfiles bootstrap scripts: : "${DOTFILES_PATH:=$HOME/.dotfiles}".
The truncation example is misleading. Commenter jiveturkey pointed out that : > file creates the file if it does not exist, not just truncate it - and that it works identically without the colon. The article could have been clearer on this distinction.
One-liners are a cultural artifact. Several commenters placed the colon tricks in the long tradition of shell golf - clever, technically interesting, but generally counterproductive in team environments where maintainability matters more than concision.
Newsletter
Get the weekly deep dive
Tutorials on Claude Code, AI agents, and dev tools, delivered free every week.
From the archive
Jul 25, 2026 • 7 min read
Jul 25, 2026 • 12 min read
Jul 25, 2026 • 22 min read
Jul 25, 2026 • 8 min read
The colon debate is a microcosm of a larger tension in developer tooling: elegance versus accessibility. Every shell feature that saves three lines for an expert costs thirty seconds of head-scratching for a newcomer. That trade-off is real, and the HN comments reflect it honestly.
But there is a case for knowing the colon even if you rarely type it. Reading other people's scripts is a daily reality - Dockerfiles, CI configs, build pipelines, deployment hooks. The : "${VAR:?error}" pattern appears in enough production shell scripts that recognizing it saves debugging time. The same goes for while : in init scripts and entrypoints.
The deeper lesson is about good tools being invisible. The colon has survived for 55 years because the shell was built to compose text-processing pipelines from tiny commands. : is the ultimate expression of that philosophy: a command that does nothing, but whose side effects (argument evaluation, parameter expansion) make everything else work.
In the age of terminal-based AI coding agents, understanding the shell's primitives is not an academic exercise. Agents like Claude Code and Codex CLI execute shell commands on your behalf. When an agent writes : "${1:?missing}" in a generated script, knowing what it does - and why it is there - is the difference between trusting the output and blindly accepting it. The same argument applies to other shell idioms that AI agents tend to generate: knowing the tools means knowing when to override them.
For developers who want to be intentional about their shell habits, the colon is worth adding to your vocabulary - not as a daily driver, but as a recognition primitive and an occasional sharp tool.
Read next
Ginger Bill argues that the best tools disappear during use - and that celebrating workarounds is a sign your tool has failed you.
5 min readA new project proposes a graphical shell layer for SSH that turns remote servers into browsable desktops. The HN discussion digs into architecture choices, the terminology debate, and whether this solves a real problem.
8 min readArmin Ronacher's new essay explores the tension between letting AI agents loop autonomously and maintaining the engineering comprehension that makes software maintainable. The Hacker News discussion adds practical caveats worth reading.
9 min readTechnical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.
Prefix prompts with ! to run shell commands directly, bypassing Claude.
Claude CodeExecute shell commands with persistent working directory in project bounds.
Claude CodeThe primary command-line entry point for Claude Code sessions.
Claude Code
A Google ADB maintainer proposed restricting on-device ADB connections to loopback, which would break Shizuku, libadb-an...

Anthropic launched the Claude Cookbook - 80+ practical guides from their engineers covering tool use, agent patterns, ev...

The Gleam programming language has migrated to Tangled, a new ATProto-based code hosting platform. Here's what this mean...

A Stack Exchange data query shows Stack Overflow's question volume dropped 65% since 2017, with a sharp acceleration aft...

Security researchers disclosed a Cursor vulnerability that auto-executes malicious git.exe files from repos - after wait...

Git 2.54 and 2.55 introduced git history with fixup, reword, and split subcommands that make interactive rebasing feel l...

New tutorials, open-source projects, and deep dives on coding agents - delivered weekly.