HN
Today

Start all of your commands with a comma

A resurfaced 2009 article proposes a surprisingly simple yet effective method for organizing personal shell commands: prefixing them all with a comma. This clever hack elegantly solves command name collisions and enhances discoverability through tab completion, prompting many Unix users to wonder why they hadn't considered it before. The discussion highlights both the brilliance and the aesthetic debates surrounding such unconventional naming conventions.

90
Score
22
Comments
#1
Highest Rank
12h
on Front Page
First Seen
Feb 7, 11:00 AM
Last Seen
Feb 7, 10:00 PM
Rank Over Time
1112233811131517

The Lowdown

The author, Brandon Rhodes, presents a solution to a common problem faced by Unix users: avoiding name collisions between personal scripts in ~/bin/ and the ever-growing number of system commands. As modern distributions like Debian boast tens of thousands of commands, the likelihood of naming conflicts increases significantly.

  • The challenge was to find a prefix character that was easy to type (no shift key), not a special shell character, and wouldn't conflict with system commands.
  • After exploring various options, the author discovered the humble comma (,) met all criteria perfectly.
  • Prefixing custom scripts with a comma ensures uniqueness and, crucially, allows for easy discoverability by simply typing , and then hitting tab for auto-completion.
  • This technique has been robust for over a decade, providing a tidy and orthogonal namespace for user-defined commands.

The Gossip

Comma's Clever Charm

Many commenters expressed surprise and delight at the simplicity and elegance of the comma prefixing idea. The most common sentiment was a mix of appreciation and self-reproach for not having thought of such an obvious solution sooner. The article's clarity and the practical benefits, especially enhanced discoverability via tab-completion, resonated strongly with readers.

Prefixing Paradox: Aesthetics vs. Utility

While many appreciated the utility, a significant portion of the discussion revolved around the aesthetic appeal and 'naturalness' of using a comma as a filename prefix. Some users found it jarring or unnatural, preferring other characters like underscores (`_`), hyphens (`--`), or square brackets (`[`). Others debated alternative strategies, such as meticulously managing `PATH` order or separating personal executables into dedicated, non-PATH directories.

Timeless Techniques and Tooling

The article, originally from 2009, sparked a conversation about the enduring nature of this problem and various long-standing solutions. Commenters shared their own established methods for namespacing and organizing custom commands, from using dedicated helper tools like 'sd' to leveraging existing shell features like aliases or oh-my-zsh plugins. The recurrence of this specific article on Hacker News over the years highlights the universal and persistent nature of the challenge it addresses.