Retrounixplan-9tech-historylinux
Rob Pike Says Unix's Hidden Dot Files Came From an ls Shortcut That Skipped Every Name Starting With a Period
To hide the . and .. directory entries, early Unix's ls skipped any name whose first character was a dot. Rob Pike calls the hidden file it created an unintended consequence and a mistake, and blames it for the hundred-odd config files in his home directory.

It started with navigation. “Long ago, as the design of the Unix file system was being worked out, the entries . and .. appeared, to make navigation easier.” Pike hedges on the date: “I’m not sure but I believe .. went in during the Version 2 rewrite, when the file system became hierarchical.”
Nobody wanted those two entries cluttering a directory listing, “so either Ken or Dennis added a simple test to the program. It was in assembler then,” he writes, meaning Ken Thompson or Dennis Ritchie. Translated into C, the test was:
if (name[0] == '.') continue;
The correct version compares the whole name:
if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0) continue;
The short one is less typing, Pike notes, “but hey, it was easy.” It also skipped every name beginning with a dot, so a file called .profile vanished from ls along with . and ... Pike: “I’m pretty sure the concept of a hidden file was an unintended consequence. It was certainly a mistake.”
The bug spread in two directions. First, other code copied it: “A lot of other lazy programmers introduced bugs by making the same simplification. Actual files beginning with periods are often skipped when they should be counted.” Then software found the blind spot useful: “As a consequence, more lazy programmers started dropping files into everyone’s home directory.”
Pike’s own count: “my home directory has about a hundred dot files and I don’t even know what most of them are or whether they’re still needed.” He argues they cost speed, too: “Every file name evaluation that goes through my home directory is slowed down by this accumulated sludge.” The files didn’t have to live there. “They could just as easily be in $HOME/cfg or $HOME/lib, which is what we did in Plan 9, which had no dot files.”
Not everyone on the Unix Heritage Society list was moved when the post went around in August 2012. Jason Hellenthal opened his reply with “With all due respect to Rob Pike, I really do not find it all that interesting,” then ran ls -A | grep ^\\. | wc -l on his own home directory and got 108. Pike’s account is his own memory, with the “I believe” left in; nobody in the thread produced the original assembler to settle who typed the test.
Fourteen years after the post, the habit Pike describes is still the default for a lot of command-line software: a new tool means a new dot file, and nothing tells you when the tool is gone. His last line is the one aimed at today’s developers: “Keep that in mind next time you want to cut a corner in your code.”