Is that correct to assume that the operating system is ALWAYS placed in /usr in all kinds of UNIX and Linux?

I'm writing a script that has to check the free space in the operating system's file system, and I want it to be generic for all kinds (RedHat, Solaris, AIX, SGI, Suse, CentOS etc...).

Thank you

  • 3
    "operating system's file system"... quite unclear what you're asking. – Jonathon Reinhart Jan 22 '14 at 6:44

Unfortunately there is no generic answer to the question that you are asking.

The reason is that Linux and Unix system allow complete freedom to install parts of the operating system in one or many partitions, local or remote.

In addition to the partitioning freedom, some sysadmins routinely create symbolic links to well-known (i.e. FHS) OS directory names such as /usr/local accross partitions. So the operating system could in fact be spread over multiple file systems. This means that there isn't in fact any concept of "operating system filesystem" in the general case.

An extreme example of this would be a Ubuntu LiveCD running with a unionfs RAM disk of 60MiB. In this case there is 60MiB of free space that is available in total but only exists as long as the OS is running.


The FHS might be of use, though as implementations might not adhere to it completely, you might want to double check.

You basically need to check /, /usr, /var (on most systems /bin and /sbin are in / and not mounted on separate filesystems). On SuSE desktop environments and some larger packages might end up in /opt and so you might want to check that as well.


Just use the df(1) tool on the actual path you're trying to write to:

$ df /usr/here-is-where-i-want-to-be/
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda2             70105504  13177408  56928096  19% /

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.