11

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?

Robert Ross
  • 431
  • 2
  • 6
  • 10

2 Answers2

15

"/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.

mulaz
  • 10,472
  • 1
  • 30
  • 37
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".

Magellan
  • 4,431
  • 3
  • 29
  • 53
  • So what would the definition of /usr/etc be? – Robert Ross Apr 29 '12 at 23:21
  • config files for user-supplied application, probably. Personally, I prefer to keep THOSE things over in /opt if they're not part of a package provided with the OS or Distribution. – Magellan Apr 29 '12 at 23:27
  • Mind you, none of this is a "rule". It's more tradition and convention and it's transgressed often enough in practice, but is generally-considered a good idea to follow. – Magellan Apr 29 '12 at 23:27
  • Right, that's more what I'm aiming towards is best practices. Perhaps a title change? – Robert Ross Apr 29 '12 at 23:36