Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Studying the lpic wikibook for the lpic exam 1, I encountered the following question.

 Which directory MUST exist in / to qualify this OS as Linux

I've searched google and the wikibook but can't find which folder in / makes a 'unix' classified as a 'linux'.

Here is the output of a linux box

vagrant@precise64:~$ ls /
bin              boot        dev        etc             home        initrd.img  
initrd.img.old   lib         lib64      lost+found      media       mnt  
opt              proc        root       run             sbin        selinux  
srv              sys         tmp        usr             vagrant     var 
vmlinuz          vmlinuz.old

Here is the output of / in Mac OSX

ls /
Applications Network      Users        bin          dev          home     
net          sbin         usr          Library      System       Volumes      
cores        etc          mach_kernel  private      tmp          var

Any other information about what makes a unix into linux is appreciated.

share|improve this question
I'm not sure there is a specific folder qualifying weather the system is Linux. Why not simply use uname -a ? – Slyx Feb 2 '14 at 6:07
To qualify as Linux, you just have to use the Linux kernel. The file system structure doesn't have anything to do with that. – brm Feb 2 '14 at 6:44
This feels like a trick question to me. en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard – slm Feb 2 '14 at 6:47
The term qualify is not proper set in this question. Linux means in first place the Linux kernel. The runnable OS consist of the Linux kernel and GNU software or Linux Distribution. There is no such thing as qualification. Almost every GNU source package gives you options to define your own paths. This is a common problem and LSB tries to face it. – user55518 Feb 2 '14 at 9:11
@bersh, Android (with no GNU userland) is also a Linux. As is the system running on the (older) Linksys routers, the stuff automobile folks are standardizing on, assorted embedded systems, ... They might not even have a user interface. Heck, you can start whatever you want as pid 1, and that program can even run fully in RAM, no filesystem at all (except for the initramfs). – vonbrand Feb 2 '14 at 19:03

To answer the LPI question I think that there isn't any actual directory and that this is a trick question! Linux has no mandatory directories that must be present, it can be installed into any directory structure(s) one chooses, it's configurable.

I did dig up this page, titled: 4. Linux Directory Hierarchy: Oriented to the Software Parts. It has this to say:


So let's summarize what the FHS has to say about Linux directories:

Linux system directories



Directory for the executables that are accessed by all users (everybody have this directory in their $PATH). The main files of your Software will probably be here. You should never create a subdirectory under this folder.


Like /usr/bin, but here you'll find only boot process vital executables, that are simple and small. Your Software (being high-level) probably doesn't have nothing to install here.


Like /usr/bin, but contains only the executables that must be accessed by the administrator (root user). Regular users should never have this directory in their $PATH. If your Software is a daemon, This is the directory for some of executables.


Like /usr/sbin, but only for the boot process vital executables, and that will be accessed by sysadmin for some system maintaining. Commands like fsck (filesystem check), init (father of all processes), ifconfig (network configuration), mount, etc can be found here. It is the system's most vital directory.


Contains dynamic libraries and support static files for the executables at /usr/bin and /usr/sbin. You can create a subdirectory like /usr/lib/myproduct to contain your helper files, or dynamic libraries that will be accessed only by your Software, without user intervention. A subdirectory here can be used as a container for plugins and extensions.


Like /usr/lib but contains dynamic libraries and support static files needed in the boot process. You'll never find an executable at /bin or /sbin that needs a library that is outside this directory. Kernel modules (device drivers) are under /lib.


Contains configuration files. If your Software uses several files, put them under a subfolder like /etc/myproduct/


The name comes from "variable", because everything that is under this directory changes frequently, and the package system (RPM) doesn't keep control of. Usually /var is mounted over a separate high-performance partition. In /var/log logfiles grow up. For web content we use /var/www, and so on.


Contains the user's (real human beings) home directories. Your Software package should never install files here (in installation time). If your business logic requires a special UNIX user (not a human being) to be created, you should assign him a home directory under /var or other place outside /home. Please, never forget that.


You may think is a bad idea to break your Software (as a whole) in many pieces, instead of keeping it all under a self-contained directory. But a package system (RPM) has a database that manages it all for you in a very professional way, taking care of configuration files, directories etc. And if you spread your Software using the FHS, beyond the user friendliness, you'll bring an intuitive way to the sysadmin configure it, and work better with performance and security.

My conclusion

So at least according to this later section to the FHS these are some directories that one could consider as loosely mandatory, but Linux doesn't have to follow the FHS. Even the LSB (Linux Standards Base) is only a guide, not a ridgid specification.

The only thing that Linux tries to adhere to is POSIX compliance, and POSIX makes no conveyances such as this when it comes to a specific variant of UNIX.


[1] The following material is excerpted from Graham Glass and King Ables, Linux for Programmers and Users, Pearson Prentice-Hall, 2006. ISBN 0-13-185748-7. p 4-15

share|improve this answer
These all apply to UNIX. If I understand the question correctly, he wants to know which directories might differentiate Linux from UNIX (maybe /sys and /selinux?) – jordanm Feb 2 '14 at 7:17
@jordanm - the source of this info came from "4. Linux Directory Hierarchy: Oriented to the Software Parts". That URL mentioned them. The URL is referenced above. – slm Feb 2 '14 at 7:30
Yes, but that is just citing the FHS, which should apply to all UNIX. – jordanm Feb 2 '14 at 7:40
@jordanm - I realize that, I'm researching this to figure it out too, I was simply citing that resource, the page I cited was further specifying the FHS wrt to Linux, if I was reading it correctly. I do not think it's /selinux since that's an optional piece of s/w and /proc and /sys and /dev are virtual, i.e. not real directories. – slm Feb 2 '14 at 7:43
It would appear the exam's "correct" answer is something like this, since lpi.org/linux-certifications/programs/lpic-1/exam-101 at the end has the line "Candidates should be thouroughly familiar with the Filesystem Hierarchy Standard (FHS), including typical file locations and directory classifications." (emphasis mine) – samiam Feb 2 '14 at 13:20

You know, I am half-tempted to make a custom Linux distribution where:

  • The boot loader puts init elsewhere, like hey_lpi_guys_this_is_a_linux_system/sh
  • By using ext2ed or a similar tool, remove '.' and '..' from the root directory (while I'm at it, hack e2fsck to not complain that '.' and '..' aren't at the top level).
  • Make sure the userspace (probably only sh since this will be a proof of concept) doesn't mind the root directory not having '.' and '..'

The fact of the matter is this: Linux can boot in to a system without a single directory which a typical Linux filesystem tends to have. And it will work. There are pretty much no musts in Linux -- that's the power of open source.

Linux flexibility is a two-edged sword. One downside is that something as simple as "how do I make sure this program is started at system boot time?" has multiple incompatible answers, depending on one's distro and init system.

share|improve this answer

I am not sure, but I would say that the question is referring to /proc. This has to exists on Linux in / as it is created by the kernel and does not reside on the disk.

Unix systems seem to have /proc as well, so it is not exclusive but I think you can read the question in the way that "if /XYZ does not exist, then it is not Linux", instead of "if /XYZ exists, it can only be Linux". The second version can always be disproved on your Mac OSX by doing sudo mkdir /XYZ for any non-yet existing directory in /

share|improve this answer
I would say that is incorrect. /proc (and /sys) are mounted by userspace in the initrd. An embedded Linux might not mount them at all. It is trivial (with chroot) to create a mostly working Linux environment without /proc). And /proc is used on many other UNIX clones - see en.wikipedia.org/wiki/Procfs - so isn't Linux specific anyway. – abligh Feb 2 '14 at 10:39
Additionally, a quick Google search shows that FreeBSD and Solaris both have /proc, e.g. docs.oracle.com/cd/E23824_01/html/821-1451/… – samiam Feb 2 '14 at 11:52
@samiam - the Q really is when the LPI says directory do they mean real or virtual? /proc, /dev, and /sys are virtual directories that the kernel's creating at boot time. – slm Feb 2 '14 at 14:32

I've deliberately put this as another answer as it relies on a very literal interpretation of the question:

Which directory MUST exist in / to qualify this OS as Linux

Well, I see:

amb@ubuntu$ ls -la /
total 1380
drwxr-xr-x  27 root root    4096 Jan  3 10:19 .
drwxr-xr-x  27 root root    4096 Jan  3 10:19 ..

(... other stuff...)

As per my other answer, no directory present in / uniquely identifies an OS as Linux as opposed to any other UNIX and is always there. However, both . and .. MUST exist in / for the OS to qualify as Linux. IE they are both necessary, but not sufficient conditions.

share|improve this answer
I think this is the answer. Every directory in Linux always has the '.' and '..' entries. Well, OK, almost always. It is possible to delete them with ext2ed or what not, but fsck complains very loudly before restoring them. – samiam Feb 2 '14 at 12:01
This is, in any case, a feature of the filesystem and not of the OS. – dmckee Feb 2 '14 at 21:05

Any other information about what makes a unix into linux is appreciated.

In terms of directory hierarchy there isn't really anything; /proc is not unique to linux. It's also used on Solaris and at least some forms of BSD. Further, I think the linux kernel can still be configured without it or sysfs support.

As you recognize, the FHS is intended to cover a variety of unix-like systems. However, it is produced and maintained by the Linux Foundation, and the current version (2.3) does include a chapter 6 "Operating System Specific Annex" with only one section, 6.1 Linux (the PDF version is nicer to read, btw). There are various linux specific conventions including a few mandatory things in /dev (null, zero, tty) and there might be a vector combining these which is unique. The reason someone hasn't identified that is probably because it would not have any use value (there are better ways to identify an OS kernel, such as asking it directly).

share|improve this answer
it can be configured that way; you can turn off procfs and sysfs support at compile-time. they're probably modules, anyway. that being said, these are sufficiently mature that you are likely to break some of userland by doing so. (and, as a side note, /proc isn't even specific to UNIX. Plan 9 has it.) – strugee Feb 2 '14 at 22:40
@strugee : I'd guess there are some embedded contexts with a specialized userland that don't don't use proc/sys. – goldilocks Feb 7 '14 at 14:47
very true, of course. we are talking about the Linux kernel - It's About Choice(tm). I meant a standard userland. – strugee Feb 7 '14 at 16:44

Linux is a clone of the operating system Unix, written from scratch by Linus Torvalds with assistance from a loosely-knit team of hackers across the Net. It aims towards POSIX and Single UNIX Specification compliance.

It has all the features you would expect in a modern fully-fledged Unix, including true multitasking, virtual memory, shared libraries, demand loading, shared copy-on-write executables, proper memory management, and multistack networking including IPv4 and IPv6.

The Linux Kernel Archives - About Linux Kernel - What is Linux?.

From the Single UNIX Specification link:

Common Directories and Devices

The Single UNIX Specification describes an applications portability environment, and as such defines a certain minimal set of directories and devices that applications regularly use. The following directories are defined:

    The root directory of the file system.

    Contains the devices /dev/console, /dev/null, and /dev/tty.

    A directory where applications can create temporary files. 

The directory structure does not cross into such system management issues as where user accounts are organized or software packages are installed. Refer to XBD, Section 10.1, Directory Structure and Files for more information.

XBD, Chapter 10, Directory Structure and Devices also defines the mapping of <control>- char sequences to control character values, and associated requirements on system documentation.

From the Open Group IEEE Std 1003.1, 2013 Edition i.e. POSIX:

The following directories shall exist on conforming systems and conforming applications shall make use of them only as described. Strictly conforming applications shall not assume the ability to create files in any of these directories, unless specified below.

    The root directory.
    Contains /dev/console, /dev/null, and /dev/tty, described below.

The following directory shall exist on conforming systems and shall be used as described:

    A directory made available for applications that need a place to create temporary files. Applications shall be allowed to create files in this directory, but shall not assume that such files are preserved between invocations of the application.

The following files shall exist on conforming systems and shall be both readable and writable:

    An empty data source and infinite data sink. Data written to /dev/null shall be discarded. Reads from /dev/null shall always return end-of-file (EOF).
    In each process, a synonym for the controlling terminal associated with the process group of that process, if any. It is useful for programs or shell procedures that wish to be sure of writing messages to or reading data from the terminal no matter how output has been redirected. It can also be used for applications that demand the name of a file for output, when typed output is desired and it is tiresome to find out what terminal is currently in use.

The following file shall exist on conforming systems and need not be readable or writable:

    The /dev/console file is a generic name given to the system console (see System Console). It is usually linked to an implementation-defined special file. It shall provide an interface to the system console conforming to the requirements of General Terminal Interface. 

Since the SUS required directories are a subset of the POSIX conforming ones, and since Linux aims towards compliance with both, then we can say that an OS qualifies as Linux in that respect if it has the *POSIX* conforming list of 5 directories plus the root(/) directory.

share|improve this answer

The question you are being asked is poor (not the SO question).

I suspect the answer they are looking for is either /boot or /sys, but both of those are wrong. I think a better answer is /sbin.

Here's what's in my root directory:

  • /bin
  • /boot
  • /cdrom
  • /dev
  • /etc
  • /home
  • /lib
  • /lib32
  • /lib64
  • /lost+found
  • /media
  • /mnt
  • /proc
  • /root
  • /run
  • /sbin
  • /selinux
  • /srv
  • /sys
  • /tmp
  • /usr
  • /var

Of the directories used by Linux, the following are in SuS or otherwise in common use across many UNIXes:

The following are unique (or near unique) to Linux, but there are plenty of Linux configuration (embedded ones, old ones etc.) that don't need them:

  • /lib32
  • /lib64
  • /selinux
  • /sys

The following are entirely distribution / user dependent and could apply to any UNIX:

  • /media
  • /cdrom
  • /srv

This one is there on nearly every Linux, but is unnecessary on (e.g.) EC-2 where you use an external kernel, as well as on some embedded Linux configurations:

  • /boot

So there is no directory which

  • is present on all Linux instances; and
  • is not present on any non-Linux instances

So what is the right answer? If you take the question 'Which directory MUST exist in / to qualify this OS as Linux' completely literally, it might mean 'which directory, if absent, would make it not linux'. The answer here is not the linux-y /proc, /sys, /selinux or /boot as you can run Linux quite happily without these in some circumstances - indeed you can compile the kernel without support for the first 3 and the last is a bootloader convention.

I would say the answer is /sbin. Why? Well /sbin is the only directory hard coded into the linux kernel, in that the default boot code executes /sbin/init. It does not refer to /bin or anything else. Theoretically the others could all be renamed without changing the linux kernel.

share|improve this answer
Well, you could have init be /bin/sh and then not need the /sbin directory by setting Grub (or whatever) to have the kernel use a different init. – samiam Feb 2 '14 at 11:59
That's true (using the init= kernel command line option). But it remains the fact that it is the only directory in / referred to by the Linux kernel, other than . and .. (as per my other answer - which I am increasingly thinking is the right one) – abligh Feb 2 '14 at 12:05
Some distributions (at least Fedora and Arch) have a /sbin/ symlinked to /usr/sbin or even /usr/sbin to /usr/bin so they don't contain a directory sbin. – Maciej Piechotka Feb 2 '14 at 20:20

Filesystem folder names is not something which can classify Unix as Linux or not. In fact, there exists a counter-example to any common Linux distribution filesystem, which is called GoboLinux (the idea behind it is the complete reorganization of the filesystem).

As an afterthought, one potentially can rename any directory with any name making even a standard filesystem unrecognisable.

share|improve this answer

protected by slm Feb 3 '14 at 13:11

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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