Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Initially I thought it was a coincidence, but now I see there's even a tag for it: all hidden file names start with a dot. Is this a convention? Why was it chosen? Can it be changed? Or in other words (as a related question @evilsoup suggested that implies the answer to a bunch of others): can I hide files without renaming them (using . as the first character of their name)?

share|improve this question
    
Or "why do all hidden file names start with a dot?", if you prefer. –  JMCF125 Aug 30 '13 at 14:14
1  
Yes it's a convention, as to why it was chosen who knows, go ask the UNIX pioneers, it's an old convention. –  terdon Aug 30 '13 at 14:16
4  
Read the related Wikipedia article about hidden files and plus.google.com/101960720994009339267/posts/R58WgWwN9jp for the history aspects. It cannot be changed. –  jofel Aug 30 '13 at 14:19
    
I thought Linux was fully customizable... –  JMCF125 Aug 30 '13 at 14:25
1  
@JMCF125 actually that comment came out as a bit more sarcastic than I intended, sorry about that. Are you actually asking: 'can I hide files without renaming them?' -- if that is the case, you should edit that into your question. –  evilsoup Aug 30 '13 at 16:39

2 Answers 2

up vote 4 down vote accepted

According to Wikipedia,

The notion that filenames preceded by a . should be hidden is the result of a software bug in the early days of Unix. When the special . and .. directory entries were added to the filesystem, it was decided that the ls command should not display them. However, the program was mistakenly written to exclude any file whose name started with a . character, rather than the exact names . or ...

...so it started off as a bug, and then it was embraced as a feature (for the record, . is a link to the current directory and .. is a link to the directory above it, but I'm sure you know that already). Since this method of hiding files actually is good enough most of the time, I suppose nobody ever bothered to implement Windows-style file hiding.

There's also the fact that implementing different behaviour would produce an even greater amount of fragmentation to the *nix world, which is the last thing anyone wants.

There is another method for hiding files that doesn't involve renaming them, but it only works for GUI file managers (and it's not universal amongst those -- the major Linux ones use it, but I don't think OSX's Finder does, and the more niche Linux file managers are less likely to support this behaviour): you can create a file called .hidden, and put the filenames you want to hide inside it, one per line. ls and shell globs won't respect this, but it might be useful to you, still.

share|improve this answer
    
That hiding doesn't work on Unity though. But as you directly addressed all questions, I'll mark this as the accepted answer (although I upvoted both answers). –  JMCF125 Aug 30 '13 at 20:14
    
The Wikipedia page no longer contains information on this. However, Rob Pike worked on UNIX at Bell Labs and made a short post about the topic: plus.google.com/u/0/+RobPikeTheHuman/posts/R58WgWwN9jp –  Alexander Mar 12 at 10:30

Files starting with a dot are ignored by default by the command "ls", which has more or less the same effect of "hidden" files but is not the same (other commands may choose to do the same or not). Files starting with a dot are not "hidden" because "hidden" is not one of their attributes. Unlike in DOS/Windows, "hidden" is not an attribute in Unix. There are many attributes in Unix ("man chattr" will tell you all of them) but hidden is not one of them.

The reason why dot-files are ignored by "ls" is actually quite funny / embarassing. It was not a design decision but the result of a software bug in the early days of Unix. When the special . and .. directory entries were added to the filesystem, it was decided that the ls command should not display them becasue they were getting in the way. However, the program was hastily written to exclude any file whose name started with a . character, rather than the exact names "." or "..". And it created a precedent that has been followed since then in Unix. Funnily enough, when the Unix guys moved on to create Plan 9 they did not put dot-files in it on purpose.

share|improve this answer
    
I did try man chattr, though I thought perhaps I'd need some package or specific program to make other hidden files possible. –  JMCF125 Aug 30 '13 at 17:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.