35

For example, in My Documents, there are the following folders:

.ssh
.subversion

Is this some sort of naming convention that I am unaware of?

1 Answer 1

96

This naming convention comes from Unix-like operating systems (such as Linux or OS X), where it means a "hidden" file or directory. It works anywhere, but its primary use is to hide configuration files in your home directory (e.g. ~/.cache/ or ~/.plan – they're frequently called "dotfiles").

Dotfiles could, in a way, be called the traditional Unix equivalent to the "AppData" directory on Windows. (Many Linux programs are being changed to follow the XDG base directory specification, moving their configuration to ~/.config/ and other data to ~/.cache/ & ~/.local/share/ – this makes it a little more similar to AppData\Roaming and AppData\Local.)

You have these .ssh and .subversion directories on Windows because you've used some programs – specifically, OpenSSH and Subversion – that have been ported to use Windows system APIs rather than POSIX ones, but haven't been adjusted for some other Windows conventions.

Sometimes this adaptation is skipped intentionally, to make life easier for people who use Unix-like environments such as Cygwin on their Windows systems. For example, Cygwin installs the standard set of Unix-like tools like ls, which ignores the Windows "hidden" flag and only honors the .dotfile names. Also, using the same location (e.g. <home>/.ssh) can make it easier to synchronize configuration between one's Windows and Linux/BSD/OSX computers.

Also: Typically these files are in the user's home directory, e.g. /home/name/.ssh on Linux, or C:\Users\name\.ssh on Windows 7+. It is quite rare for them to be put in the "Documents" or "My Documents" subdirectories.


As Rob Pike writes on Google+, this was an accidental feature:

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.

9
  • Thank you! Very thorough. In my "C:\users\<username>\" folder, I tried using the "ls" command in Windows PowerShell and again in Cygwin Terminal. PowerShell lists the dot-files and hides AppData, whereas Cygwin Terminal does the exact opposite. Interesting! Cygwin is using the Unix convention. May 22, 2014 at 21:21
  • 1
    @Ruslan: For example: VMS did not have hidden files at all; you'd just end up with things like LOGIN.COM or DECW$MAIL.DAT in your home directory. (I'm not sure which other systems were popular at that time.) Unix had just recently been created; it did not have any conventions at all. May 23, 2014 at 13:56
  • 1
    Digital Research was not related to Digital Equipment Corporation, and CP/M was not based on any DEC operating system, though it likely was inspired to some degree by one or more of them. May 23, 2014 at 16:05
  • 2
    @grawity MS-DOS 1.0 was a DEC-style O/S done by Digital Research and bought by Microsoft, who were in the Unix business back then. MS-DOS 2.0 and later added a hierarchical filesystem and some of the Unix conventions including .. for "up dir"; Microsoft actually advertised these "advanced Unix features".
    – Fred Foo
    May 23, 2014 at 22:04
  • 1
    @grawity Ah right, it was Seattle Computer Products cloning DRI's CP/M. Sorry. But my point was that Microsoft was a Unix shop back in the early 80s, and DEC systems weren't the only point of departure. (Unix originally ran on DEC hardware, but was I think influenced more by CTSS and Multics than DEC OS's.)
    – Fred Foo
    May 26, 2014 at 9:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .