Page 1 of 5 123 ... LastLast
Results 1 to 10 of 41

Thread: Hidden files and folders - Why the . character in file / folder name instead of using a flag?

  1. #1
    Join Date
    Jan 2009
    Location
    Romania, Bucharest
    Posts
    392

    Default Hidden files and folders - Why the . character in file / folder name instead of using a flag?

    More of a general Linux question, but since openSUSE is my distribution I'm asking here. Like I said I'm moving from Windows 7 to SUSE, and inevitably comparing many things on the way. Something I'm slightly confused about is the way Linux chooses to mark hidden files / folders compared to Win. While in Windows you right-click them and mark them as 'hidden', in Linux they are marked this way by putting a dot in the file / folder name (eg: ".something" instead of "something").

    I'm slightly confused as to why the name is being used to mark things as hidden. One feature in Linux compared to Windows (positive I'd say) is being able to use mime types instead of extensions, making them optional. Yet for hidden files it's the other way around... you need to rename instead of being able to use a different kind of mark. At a first look, it doesn't seem optimal for one thing... since the name is being used to toggle a feature / setting instead of just being that file or folder's name.

    The real issue I'm imagining is that if you're using a file or folder as part of a full path, then want to mark it as hidden later on (say you don't want to see it all the time in Dolphin) its path would change. So if you have the location /foo/bar (where bar is a file and foo a folder) and you wanna make foo a hidden folder, the path would then become /.foo/bar and would need to be updated in any script or application relating to it. Not sure if the Linux path system can automatically translate this (ignore the . and use the old path, or the other way around) which would offer an advantage. Also, would this allow items with the same name to exist in the same folder (filename and .filename)?

    What are the benefits of hiding things this way, and are there alternative ways to mark files and folders as hidden? Note that I'm not trying to "make Linux be like Windows" nor mind how it works. Others know better why it was done this way, but I'm trying to learn why this option was chosen and is still used in Linux at this day.
    openSUSE 13.1 64bit, KDE 4.11.3

  2. #2
    dd@home.dk NNTP User

    Default Re: Hidden files and folders - Why the . character in file / foldername instead of using a flag?

    ok, so the first thing you need to get a grip on is that linux is a
    multi-user system.

    now that is not like a laptop that you share with your
    room-mate/whoever...no, its like back in the old days (say in an
    insurance company or bank) there was ONE computer (probably made by IBM)
    stuck in a "computer room" in the back office and all the folks out
    front who needed "a computer" were given a *terminal*..

    and, each terminal was connected to "the computer"..

    to keep Clara the Clerk from reading that she was gonna be fired by Bob
    the Boss next week (and other reasons) each users data was kept in each
    person's personal *home* space...Clara couldn't read in Bob's /home and
    vice versa

    and, by the way the guy who worked in the back office and knew
    everything because he could read in everyone's home, and erase their
    files, and cause all sorts of bad (or good) things (like change
    passwords, add new users, delete users, make backups, and fidddle with
    The Computer [rather than just the terminal] and etc was named The
    System Administrator, or root.

    now since Clara and Bob were able to see into their own home, sometimes
    (because they were just 'regular' people--not nerds) they might happen
    up on a file that they didn't remember writing!! and being mere mortals
    they were sometimes known to erase them! [this actually happened, if you
    can believe it] but, those files in their home that they didn't write
    were _needed_ to be there! the system used them for stuff....so, root
    devised an EASY way to hide files from mortals so they couldn't so
    easily gum up the works!! [just build the system so regular users
    couldn't see a file name beginning with a dot, simple, quick, easy,
    foolproof and root could easily change every file in the entire
    insurance company named (say) wordstar_configure from being seen to
    being unseen by mortals with just ONE small command]

    ok?

    by the way, since all of this was going on (including files were
    'hidden' behind a dot) while Bill Gates (and Steve Jobs) were in grammar
    school (or earlier), you really should (instead of asking here why we
    don't do it the MS way) why not ask him why he didn't do the *nix way.

    http://www.linfo.org/hidden_file.html

    --
    dd

  3. #3
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    21,544

    Default Re: Hidden files and folders - Why the . character in file / foldername instead of using a flag?

    On 2012-09-30 12:06, MirceaKitsune wrote:
    >
    > More of a general Linux question, but since openSUSE is my distribution
    > I'm asking here. Like I said I'm moving from Windows 7 to SUSE, and
    > inevitably comparing many things on the way. Something I'm slightly
    > confused about is the way Linux chooses to mark hidden files / folders
    > compared to Win. While in Windows you right-click them and mark them as
    > 'hidden', in Linux they are marked this way by putting a dot in the file
    > / folder name (eg: ".something" instead of "something").


    Well, I don't know. I'm also curious as to why, I just stored the fact as something that is
    different. And executables are marked with a flag instead of an extension. I guess that they
    found out the need to hide files after the flags were designed.

    For example, there are also extended attributes, on xfs filesystems: the normal set of
    attributes is too limited (man attr). And there are acl, access control lists, another set of
    permissions to add to a file. Additions. Instead of modifying the initial set, they added
    different sets in different manners.

    Remember that unix pre-dates MSDos, thus some features were experimented here earlier.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 12.1 x86_64 "Asparagus" at Telcontar)

  4. #4
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,693

    Default Re: Hidden files and folders - Why the . character in file / foldername instead of using a flag?

    Am 30.09.2012 14:08, schrieb Carlos E. R.:
    > Remember that unix pre-dates MSDos, thus some features were experimented here earlier.

    I am almost sure if UNIX where designed today instead of decades ago
    "hidden" would be an attribute (and we would have much more attributes
    and acls by default). The prefix dot notation is just backwards
    compatibility and was obviously good enough not to change it to
    something else.

    --
    PC: oS 12.2 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.8.4 | GeForce GT 420
    ThinkPad E320: oS 12.2 x86_64 | i3@2.30GHz | 8GB | KDE 4.9.1 | HD 3000
    eCAFE 800: oS 12.2 i586 | AMD Geode LX 800@500MHz | 512MB | KDE 3.5.10

  5. #5
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    15,589

    Default Re: Hidden files and folders - Why the . character in file / foldername instead of using a flag?

    The explanations above are all true and partly explain this in a colourfull way.

    In the beginning there was Unix. And there weren't many bytes on a disk. And disks were expensive (per byte). Thus the file system(s) that were designed for Unix tried to use as few bytes as possible. Thus the number of bytes spend on file administration inside a directory was kept low. And thus not much onformation can be stored there. We suffer from this until this very day: no "hidden" attribute, no "file type" information and more. When a hidden attribute was needed (as painted above) "they" ((the early Unix developers) decided for the . as start character. And then adapted the tools accordingly (the first one to think of is of course ls). It is not something of the system (the Kernel hasn;'t the concept), but it is a convention. And the designers of file managers like Dolphin keep to the convention.

    For the file type information also a bad solution was found: the magic number (See Magic number (programming) - Wikipedia, the free encyclopedia
    MS-DOS tried to do a little bit better here, having a "hidden" atribute and having a sepeartee field calld "extension" of three characters for file type information. But the latter isn't realy functioning because there is no central authority to define them.

    But "extenstions" seem to have spread to the Unix/Linux world, where they have no real meaning. Technicaly they are only the last few characters of a file name. People may use them to help themselves in deciding what a file may contain (there are even people making an ending of .sh to files that contain shell scripts of some sort, lest they forget.). And there are applications that either are hardcoded, or can be configured, to do special things on file names that end with a special character combination. Often never checking if the contents is of that type (by e.g. reading the magic number).

    MIME-types are not realy Unix/Linux either. There is no MIME type stored with your files to tell what they are. MIME-types are an Internet thing. They are send in protocols to tell what sort of file is following.

    An operating system that realy tried to have a lot of information about a file in it's file systems is VAX-VMS.
    Henk van Velden

  6. #6
    Join Date
    Jan 2009
    Location
    Romania, Bucharest
    Posts
    392

    Default Re: Hidden files and folders - Why the . character in file / foldername instead of using a flag?

    Thanks for all the info, it makes more sense now. I think the . operator should always stay there for backward compatibility of course, but wouldn't mind seeing a new form of hiding stuff as well (like a parameter). Still finding out what mime types are... I thought they're information / flags embedded into the file as an alternative to having an extension.
    openSUSE 13.1 64bit, KDE 4.11.3

  7. #7
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    4,805
    Blog Entries
    3

    Default Re: Hidden files and folders - Why the . character in file / foldername instead of using a flag?

    Quote Originally Posted by hcvv View Post
    But "extenstions" seem to have spread to the Unix/Linux world, where they have no real meaning.
    I'd say that is not entirely accurate. From the beginning, "file.c" was source code, "file.o" was compile but not linked object code.

    The operating system itself does not assign a meaning. That is left to users and applications. But that kind of use of extensions didn't spread to the unix world - it was there from the beginning.
    opensuse factory; KDE 4.13.2 (main desktop);
    opensuse 13.1, KDE 4.11.5 (laptop);

  8. #8
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    15,589

    Default Re: Hidden files and folders - Why the . character in file / foldername instead of using a flag?

    Quote Originally Posted by nrickert View Post
    I'd say that is not entirely accurate. From the beginning, "file.c" was source code, "file.o" was compile but not linked object code.

    The operating system itself does not assign a meaning. That is left to users and applications. But that kind of use of extensions didn't spread to the unix world - it was there from the beginning.
    I admit that some of those "endings" (of one character only) where used from the beginning and that applications (like compilers) used them. But they weren't called "extensions".
    Henk van Velden

  9. #9
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    21,544

    Default Re: Hidden files and folders - Why the . character in file / foldername instead of using a flag?

    On 2012-09-30 21:26, MirceaKitsune wrote:
    >
    > Still finding out what mime types are... I thought they're
    > information / flags embedded into the file as an alternative to having
    > an extension.


    No, they are strings sent from webservers and other internet services.

    Lookup the command "file", find out how it works.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 12.1 x86_64 "Asparagus" at Telcontar)

  10. #10
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    21,544

    Default Re: Hidden files and folders - Why the . character in file / foldername instead of using a flag?

    On 2012-09-30 22:36, hcvv wrote:
    >
    > nrickert;2492152 Wrote:
    >> I'd say that is not entirely accurate. From the beginning, "file.c" was
    >> source code, "file.o" was compile but not linked object code.
    >>
    >> The operating system itself does not assign a meaning. That is left to
    >> users and applications. But that kind of use of extensions didn't
    >> spread to the unix world - it was there from the beginning.

    > I admit that some of those "endings" (of one character only) where used
    > from the beginning and that applications (like compilers) used them. But
    > they weren't called "extensions".


    There are file browsers that look at the extensions for file types, not at the actual contents.
    For example, midnight commander. And konqueror or nautilus, I think.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 12.1 x86_64 "Asparagus" at Telcontar)

Page 1 of 5 123 ... LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •