What are the best practices of the usr, var, and etc folders? [duplicate]

Possible Duplicate:
Meaning of directories on Unix and Unix like systems

I'm confused about the different uses for 3 of the standard "root-level" folders: /var /etc /usr

What are the different use cases for these directories?


Solution 1:

"/etc" is used for configurations (.conf files etc). here you find all the configs and settings for your system.

"/usr" is used for "user programs". Usually your package manager installs all the binaries, shared files etc. from all programs here (except config files, which go to /etc). You can check /usr/bin for binaries, /usr/share for shared files (media, etc), /usr/share/doc for documentation,...

There is also an "/opt" folder, where there are "other" programs usually put (mostly binary programs, or programs installed from other sources (not the default package manager). Some programs like that (usually compiled) also go to "/usr/local"

"/var" is usually used for log files, 'temporary' files (like mail spool, printer spool, etc), databases, and all other data not tied to a specific user. Logs are usually in "/var/log", databases in "/var/lib" (mysql - "/var/lib/mysql"), etc.

Solution 2:

The /etc/ directory is a common location to put configuration files. (But not the ONLY one by any means.)

The /var directory is the location for "variable" things like logs, running process ID pointer files, spool directories, and other things important for running services.

The /usr/ directory is where user-accessible applications are generally located. Also a case of "by no means all".