4

What is the point of hidden files? In Microsoft Windows they exist, in Mac OS X they exist and in Linux they exist. It seems to me that it just makes detecting malware more difficult. The only upside I see is protection of necessary OS files.

5

Let me go type ls on my home directory for a moment.

~ $ ls
Desktop/      Downloads/    Movies/       Projects/
Development/  IdeaProjects/ Music/        Public/
Documents/    Library/      Pictures/     bin/
~ $ 

Yep, its a mac. And a relatively new one. I've got 12 directories there.

Now lets try ls -a

~ $ ls -a
./                   .gnome2/             Desktop/
../                  .hgignore_global     Development/
.CFUserTextEncoding  .inkscape-etc/       Documents/
.DS_Store            .local/              Downloads/
.Trash/              .m2/                 IdeaProjects/
.Xauthority          .mono/               Library/
.bash_history        .oracle_jre_usage/   Movies/
.bash_sessions/      .profile             Music/
.cache/              .profile.swp         Pictures/
.config/             .rnd                 Projects/
.gitconfig           .viminfo             Public/
.gitignore_global    .vimrc               bin/

And thats not actually too bad. But there's a lot more there. And things I don't care about seeing every single type I type ls.

Lets go for a moment to my old drive and its home directory...

/Vo/Ot/Us/Shagie $ ls -1 | wc -l
     129
/Vo/Ot/Us/Shagie $ ls -a1 | wc -l
     231

I've got a fair bit there. And there is a lot more that I don't care about seeing every time I type ls.

I know I have a .profile and a .DS_STORE and a .bash_history and a .Xcode/ and .adobe/ and .Trash/ and .android/ And whats more, that .org.eclipse.epp.usagedata.recording.userId has a really long name that throws off the columns. And there's .psql_history and .sqlite_history and... yea.

It is trivial to tweak one's own .bashrc (or whatever shell you prefer) to make it so that you always see them. I've got la aliased to ls -a so if I want to see them I can with just the slightest of different character placement.

But seeing them every time I do an ls? That's not something I want. It is too much information and makes it harder for me to do what I want - find a file in this directory.

  • 2
    Then why dont they just store the .sqllite_history s8mewhere where noone would be bugged with it. A temp-folder for permanent files (appdata for example) – BlueWizard Feb 6 '16 at 20:25
  • @JonasDralle that would be something to ask the sqlite developers. – user40980 Feb 6 '16 at 20:26
  • no thats not what i mean. Hidden files allow the devs of just throwing the file in the home dir. If there would be no hidden files the devs mught have thought "that would annoy people, lets just out it somewhere where noone gets bothered while maintaining accessability" – BlueWizard Feb 6 '16 at 20:28
  • @JonasDralle you need a place that is writable by the user and persistent. A hidden file/directory under the well defined home directory is likely the only place that this exists across all systems. That is only a guess though. And it doesn't bother me that they created a dot file for that. Its no different to me than .bash_history or .psql_history. – user40980 Feb 6 '16 at 20:30
  • You have described the traditional UNIX solution. @Jonas rightfully points out that there is another approach, like the one used in OS X: put configuration stuff in ~/Library (though it also uses dotfiles for compatibility). Interestingly though, since OS X 10.7, ~/Library is hidden in the Finder, but not hidden at the filesystem level. – 200_success Feb 7 '16 at 18:06
6

On Unix they were an accident at least initially

https://plus.google.com/+RobPikeTheHuman/posts/R58WgWwN9jp

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.

  • That's really interesting. – LawrenceC Aug 18 '17 at 17:27
2

No comment on the original creation of hidden files but now that they exist it's very tempting to keep using them.

Hidden files offer a convenient mechanism for associating arbitrary metadata with a directory location while remaining largely independent of file system or OS mechanics. There might be "better" ways to store folder icons or search indices for a directory as part of a file system but then I might find that those features only work on select partitions. Similarly there might be a "better" home for user configuration data but it's difficult to introduce one which wouldn't degrade the use of existing programs or be incompatible with existing file systems.

Hidden files are just hidden enough to discourage most users from accidentally invalidating that metadata by moving or removing them while remaining standard enough to be universally available and flexible enough to support a wide range of use cases.

  • Yep. OSX now even stores stuff in hidden files on its own native HFS+ filesystem just because it's more convenient that way if you want to copy your directory to another filesystem. In Windows, for example, if you copy a file that has extended attributes or alternate data streams to a FAT filesystem, all that data is silently discarded. Other operating systems try to extract the metadata from the file and store it in the target filesystem. OSX's way is (at least in some way) elegant: store it in a file besides the original, and when you copy the whole directory, the hidden files just come with – Jörg W Mittag Feb 6 '16 at 2:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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