One of the most confusing things when doing basic server maintenance or troubleshooting on a remote machine is where everything is located. A basic understanding of the Filesystem Hierarchy Standard is helpful - though there are, of course, exceptions all over the place, and the standard isn't always consistent! The main directories you'll probably be interested in are:
Main system binaries that come bundled with the operating system are stored here. Generally speaking you want to keep out of this main bin directory. Everything in the
/bin directory is available to all users.
This is probably the most confusing directory name - just as you may have assumed, this originally did indeed mean the 'etcetera' directory, i.e. everything that wasn't acounted for elsewhere. Binaries are not allowed to be stored in
/etc and generally it's used to store configuration files for various programs. This directory is where you will find the configuration files for webservers like Apache (/etc/apache2) and nginx (/etc/nginx).
User home directories are found here. MacOS also has a home directory, however that is generally empty, and instead MacOS uses a
This is for libraries associated with the binaries in
/bin. These are things like templates and modules associated with the binary application files. In MacOS this is called
This is another directory for system binaries, but they are only available to the
root user or other users in
Officially this is for "Site-specific data served by this system, such as data and scripts for web servers, data offered by FTP servers, and repositories for version control systems."
However - see notes under
var, becuase website files usually are NOT put in
/srv by default.
Temporary files. Usually files stored here will be deleted on reboot. See also
Secondary hierarchy for read-only user data; contains the majority of (multi-)user utilities and applications. Mostly this has the same subdirectory structure as the root directory i.e.
Tertiary hierarchy for local data. Mostly this has the same structure as the root directory as subdirectories i.e.
usr/local/lib and so on. When writing your own executable scripts you generally should save the binary at /usr/local/bin because the other binary directories can be overwritten by the system when you do an operating system upgrade.
For 'variable' files. This is for files that are expected to change a lot, such as logs, print queues and databases.
One important exception to this is that in many Linux distributions, including the very popular Ubuntu Linux, any website files go into
/var/www/html by default. This doesn't really comply with the official standards, because they're supposed to go into
/srv, but has become something of a de facto standard
Temporary files are stored here and will be retained on reboot.
Go back to the workshop
Go to Projects