Origin of Unix Dot File Names (Rob Pike. 2012)
Rob Pike, blogged in his Google Plus account about the history of unix convention of file name starting with dot or dot dot.
https://plus.google.com/u/0/101960720994009339267/posts/R58WgWwN9jp.
Link dead. Here's the full text. Article written around 2012-08-03
A lesson in shortcuts.
Long ago, as the design of the Unix file system was being worked out, the entries
.
and..
appeared, to make navigation easier. I'm not sure but I believe..
went in during the Version 2 rewrite, when the file system became hierarchical (it had a very different structure early on). When one typed ls, however, these files appeared, so either Ken or Dennis added a simple test to the program. It was in assembler then, but the code in question was equivalent to something like this:if (name[0] == '.') continue;This statement was a little shorter than what it should have been, which is
if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0) continue;but hey, it was easy.
Two things resulted.
First, a bad precedent was set. 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.
Second, and much worse, the idea of a “hidden” or “dot” file was created. As a consequence, more lazy programmers started dropping files into everyone's home directory. I don't have all that much stuff installed on the machine I'm using to type this, but 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. Every file name evaluation that goes through my home directory is slowed down by this accumulated sludge.
I'm pretty sure the concept of a hidden file was an unintended consequence. It was certainly a mistake.
How many bugs and wasted CPU cycles and instances of human frustration (not to mention bad design) have resulted from that one small shortcut about 40 years ago?
Keep that in mind next time you want to cut a corner in your code.
(For those who object that dot files serve a purpose, I don't dispute that but counter that it's the files that serve the purpose, not the convention for their names. 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. Lessons can be learned.)
- To the unix fanatics, this post probably makes today's linux more endearing.
- To me, it's another account of unix's pervasive and permanent damage to the computing industry.
- The unix svn idiots finally removed its dot files littered in your dirs in 2011 (svn v1.7).
unix dot file problem
Unix cult related, y2k
- Unixer Plain-Text Email Fetish (2002)
- Unix, RFC, and Perl Email Libs (2001)
- Unix and the mbox Email Format (2002)
- Unix, RFC, Line Truncation (2002)
- Idiocy Of Unix Copy Command (2010)
- The Elements Of Style: UNIX As Literature (2001)
- On Unix Filename Characters Problem (2008)
- Unix And Literary Correlation (2001)
- What is the Max Number of Directories a Directory Can Have? (2011)
- Origin of Unix Dot File Names (Rob Pike. 2012)
- Unix, Security, and FTP (2005)
- Is Mac OS X Unix (2002)
- The Unix Pestilence: MySQL (2002)
- Mac OS X SSH Session Disconnection (2010)
- Mac OS X Changes To Unix (2010)
- On Microsoft Hatred (2002)
Why UNIX sucks series
- The Unix-Haters Handbook
- The Nature of the Unix Philosophy
- Origin of Unix Pipe
- Do Unix Tools Do One Thing Well
- Why Unix Man Page Sucks
- Why Unix Shell Syntax Sucks
- Why Bash Sucks
- Origin of Unix Dot File Names (Rob Pike. 2012)
- UNIX Philosophy, Fast Food the UNIX way
- On Unix File System's Case Sensitivity (2001)
- On Unix Filename Characters Problem (2008)
- Unix and the mbox Email Format (2002)
- Unix, RFC, Line Truncation (2002)
- The X-Windows Disaster (X11) (1994. Don Hopkins)
- The Unix Pestilence (2003)