Is the slash (/) really part of the name of the Linux root directory? Or is it just a symbol for it?

What about /etc and so on?


Suppose /dev/sda2 is the block device of a Linux root directory.

$ sudo debugfs /dev/sda2
debugfs 1.44.1 (24-Mar-2018)
debugfs:  pwd
[pwd]   INODE:      2  PATH: /
[root]  INODE:      2  PATH: /
debugfs:  stat /
Inode: 2   Type: directory    Mode:  0755   Flags: 0x80000
Generation: 0    Version: 0x00000000:00000077
User:     0   Group:     0   Project:     0   Size: 4096
File ACL: 0
Links: 25   Blockcount: 8
Fragment:  Address: 0    Number: 0    Size: 0
 ctime: 0x5b13c9f1:3f017990 -- Sun Jun  3 15:28:57 2018
 atime: 0x5b13ca0f:3b3ee380 -- Sun Jun  3 15:29:27 2018
 mtime: 0x5b13c9f1:3f017990 -- Sun Jun  3 15:28:57 2018
crtime: 0x5aad1843:00000000 -- Sat Mar 17 16:59:39 2018
Size of extra inode fields: 32

So there is a directory in there, inode #2, but it hasn't a name.

  • 1
    Regarding your recent update showing some debugfs output. Can you clarify how this changes the question?
    – Kusalananda
    Commented Jun 3, 2018 at 12:58
  • It dosn't. I just wanted to complete the answers. but i didnt want to add another one. so i updated it. if u can put thease line in your answer in will delete them
    – mlibre
    Commented Jun 3, 2018 at 13:22

4 Answers 4


The POSIX.1-2008 standard says

A pathname consisting of a single / shall resolve to the root directory of the process. A null pathname shall not be successfully resolved.

The standard further makes a distinction between filenames and pathnames. / is the pathname of the root directory. The name of the directory is "the root directory", but in the filesystem it is nameless, it does not have a filename. If it had a filename, that name would be a directory entry in the directory above the root directory, and there is no such directory.

The character / can never be part of a filename as it is the path separator.

For clarity: / is not the name of the root directory, but the path to it, its pathname.

/etc is another pathname. It is the absolute path to the etc directory. The name of the directory at that path is etc (its filename is etc).

/usr/local/bin/curl is the pathname of the curl executable file in the same way that /etc is the pathname of the etc directory.

  • "If it had a filename, that name would be a directory entry in the directory above the root directory" It would be two things, technically - inode number and name (which as we know is inode 2). It's also interesting to note that /.. points back to /, and / does have directory entry for itself - that's the good old /.; all those 3 things are pointing to the same inode - 2. Commented Jun 3, 2019 at 22:24
  • 1
    @SergiyKolodyazhnyy Technically, the root directory is "per-process", which matters in chroot environments. In a chroot, the inode number of the root directory would not be a particular number (it would be the inode number of the chroot root). Also, I think that the number 2 (in non-chrooted situations) is depended on the filesystem used.
    – Kusalananda
    Commented Jun 3, 2019 at 22:28
  • I also noticed that / is defined in terms of per-process root but I didn't know that inode in chroot isn't necessarily 2. Very interesting fact. It also raises a question of what is the / directory for privileged kernel processes. Does that mean only user-space processes have / with which they associate ? Commented Jun 3, 2019 at 22:37

slash is a separator; directory names do not include separators, but full pathnames include the separators.

So the "root-level" / has no name. On most Unix-like systems, this is treated as a special case like . and .. (though of course there is no difference between the two at the root level).

Nomenclature can differ. POSIX.1-2017, for example, lists some commonly used definitions:

  • 3.2 Absolute pathname

    A pathname beginning with a single or more than two <slash> characters; see also Pathname.

  • 3.271 Pathname

    A string that is used to identify a file. In the context of POSIX.1-2008, a pathname may be limited to {PATH_MAX} bytes, including the terminating null byte. It has optional beginning <slash> characters, followed by zero or more filenames separated by <slash> characters. A pathname can optionally contain one or more trailing <slash> characters. Multiple successive <slash> characters are considered to be the same as one <slash>, except for the case of exactly two leading <slash> characters.

    Note: If a pathname consists of only bytes corresponding to characters from the portable filename character set (see Portable Filename Character Set), <slash> characters, and a single terminating <NUL> character, the pathname will be usable as a character string in all supported locales; otherwise, the pathname might only be a string (rather than a character string). Additionally, since the single-byte encoding of the <slash> character is required to be the same across all locales and to not occur within a multi-byte character, references to a <slash> character within a pathname are well-defined even when the pathname is not a character string. However, this property does not necessarily hold for the remaining characters within the portable filename character set.

  • 3.272 Pathname Component

    See Filename in Filename.

  • 3.170 Filename

    A sequence of bytes consisting of 1 to {NAME_MAX} bytes used to name a file. The bytes composing the name shall not contain the <NUL> or <slash> characters. In the context of a pathname, each filename shall be followed by a <slash> or a <NUL> character; elsewhere, a filename followed by a <NUL> character forms a string (but not necessarily a character string). The filenames dot and dot-dot have special meaning. A filename is sometimes referred to as a "pathname component". See also Pathname.

So... if you are looking for clarification, that might not be your first stop. Tutorials such as this UNIX Concepts page are helpful, e.g., pointing out that "full pathname" is synonymous with "absolute" pathname".

  • 4
    Nitpick: dot and dot-dot are filenames, not pathnames. Actually, the POSIX standard has the curious formulation "As a special case, in the root directory, dot-dot may refer to the root directory itself." (my emphasis).
    – Kusalananda
    Commented Jul 24, 2016 at 16:13
  • 1
    So, reading the specification to the letter, / is not a valid filename or a pathname component, and it's not a string that contains such components but it's still a completely valid pathname for one certain directory. Which has to exist, though the part that demands this doesn't mention its "name". Somehow, I find this slightly amusing.
    – ilkkachu
    Commented Jul 24, 2016 at 17:04
  • It's answered in POSIX: It has optional beginning characters, followed by zero or more filenames separated by characters. Commented Jul 24, 2016 at 17:07
  • @Kusalananda review the spec rationale for your emphasis. the may in spec defines is a clear statement of surety with regards to implementation tests. where may is used, the spec assures any budding adherent of defined behavior. in other words, any implementation may rely on .. at / linking /.
    – mikeserv
    Commented Aug 28, 2018 at 22:21

In Unix, files (and directories are just files) don't have "names". Links have names, links are entries in a directory that map names to files.

You might say, that links give names to files, but note: this implies that a file can have more than one name, since it can have more than one link.

Since the root directory is, well, the root directory, there is no "higher-up" directory within which there could be a link to it, so there cannot be a name associated with it. It would theoretically be possible to add a link to the root directory within some other directory, but most Unices forbid adding links to existing directories, because it may lead to cycles in the filesystem hierarchy (which is actually a directed graph), and detecting cycles in a graph is expensive, but not detecting them can lead to infinite recursion when trying to resolve names within the kernel.

So, basically, the root directory has no name, because there is no directory above it within which we could record the name.

As was pointed out in other answers, we need to distinguish between a name and a path(name). The root directory can be referred to via the path(name) /.

  • 1
    Yes, files can have more than one name, just like people. My younger daughter's husband normally goes by his middle name, but he obviously has to answer to his first name too. The root directory's main name is "/", pronounced "slash", because its absolute pathname is "/" (and names based on relative pathnames aren't particularly helpful). (Calling it "root" risks confusion with "/root", which should always be called "slash root". Commented Jul 25, 2016 at 16:16
  • 1
    I like the point that it has no name because there is no higher directory in which to record that name. That clarifies the concept nicely.
    – Joe
    Commented Jul 30, 2016 at 7:25

The use of the word "name" is a little bit flexible; it can refer to a "fully qualified path name"; it could refer to the "directory entry"; it could refer to the "file name" passed to various functions or routines.

So, for example, /etc/foo and /var/tmp/../../etc/foo and /tmp/../../../../../../foo are all ways of referring to the same file; they're all valid names, as is foo when in the /etc directory.

So let's go back to basics.

A filename in unix is made of of components separated by the directory separator /. Pretty much the only restriction on components is that they can't contain the / or NUL characters; anything else is permitted.

So the "fully qualified path name" of /etc is the full string: /etc. This means it has the etc component in the root directory.

Similarly /x/y/z/foo would have the foo component in the /x/y/z directory.

Now the root directory is unique in that it has no component in a parent directory; it only has the full pathname as its name: /.


You must log in to answer this question.

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