LockerGnomeTech news and nostalgia for today's technology professionals
Subscribe

Search

Retrounixbell-labspipesshellhistory

The First Unix Pipes Used > Instead of |, and Dennis Ritchie Said a Missing > Created a File Instead of Running the Command

Doug McIlroy pushed for pipes for years before they went into Unix in 1972. Ritchie's own history says the first notation reused the redirection arrows, and it lasted only a couple of months.

Chris tightens a rigid pipe union joining the second of three machines to the third, as beads pour in a funnel and come out sorted.
Illustration: LockerGnome

The idea is older than Unix. Ritchie kept a yellowed page of a 1964 Bell Labs memo by Doug McIlroy on his office wall. Its first point reads: “We should have some ways of connecting programs like garden hose–screw in another segment when it becomes when it becomes necessary to massage data in another way.” Ritchie noted that “the duplicated “when” phrase is historically accurate.”

McIlroy’s first proposal for Unix looked nothing like today’s shell. “He suggested that commands should be thought of as binary operators, whose left and right operand specified the input and output files,” Ritchie wrote. Copying a file would be inputfile copy outputfile, and a sort-paginate-print job would read input sort paginate offprint. “In today’s system, this would correspond to sort input | pr | opr.”

The team didn’t bite at first. “The idea, explained one afternoon on a blackboard, intrigued us but failed to ignite any immediate action,” Ritchie wrote, partly because “the infix notation seemed too radical (we were too accustomed to typing `cp x y’ to copy x to y).” His verdict on that hesitation: “What a failure of imagination!”

McIlroy kept at it. Ritchie wrote on his memo page that “Doug has been explicit in saying that he very nearly exercised managerial control to get pipes installed,” and in the history that “thanks to McIlroy’s persistence, pipes were finally installed in the operating system (a relatively simple job).”

The first notation borrowed the redirection arrows. The pipeline above “might have been written sort input >pr>opr>,” where anything after a > could be a file or a command. That last > mattered: “otherwise the command opr would not have been executed at all; instead a file opr would have been created.”

Other snags followed. Passing an option meant quoting, as in sort input >"pr -2">opr>, and because < worked in reverse, “the notation was not unique”: the same job could be typed opr <pr<"sort input"<. “The pipe notation using <' and >’ survived only a couple of months,” Ritchie wrote, before the single separator we use now replaced it.

The tools changed to fit. “The term filter' was soon coined," and many commands were rewritten, since "no one had imagined that anyone would want the sort or pr utility to sort or print its standard input." Ritchie also conceded that the idea had a precedent the team didn't know about: "the communication files’ of the Dartmouth Time-Sharing System did very nearly what Unix pipes do, though they seem not to have been exploited so fully.” He doesn’t say what those files looked like in use, and this account rests on his own pages.

Notation tends to get fixed only after people use it daily, and a syntax that overloads an existing symbol usually gives way to one with a single meaning. Command languages being designed now, for build tools, data pipelines and AI agents chaining tools together, are likely to go through the same short-lived first notation before settling on one operator people can’t misread.

More Retro

Every Retro story →