0

Whenever I see unix tutorials, I see them using:

/var/...

is var just a placeholder for an example?

user2659
  • 1,152
  • 4
  • 20
  • 32

3 Answers3

4

No. /var is a directory. It tends to contains "variable" data - that is data that is going to tend to change and often not configuration files. (eg. /var/mail for mail storage, /var/vm for where virtual memory is stored)

For more information on how directories are laid out on Unix check out question 24523

Chealion
  • 5,713
  • 27
  • 29
  • in your example directory is a more appropriate term http://en.wikipedia.org/wiki/Folder_(computing)#The_folder_metaphor – monomyth Nov 23 '09 at 23:11
2

No, /var is a directory in the filesystem. One of the directories often referred to that exists under that is /var/log where most of the system and many of the application logs are kept.

"foo", "bar", "baz" and the like are placeholders.

Dennis Williamson
  • 60,515
  • 14
  • 113
  • 148
  • "foo", "bar" and "baz" are traditional metasyntactic variables (http://www.jasonantman.com/jargon/entry.php?id=metasyntactic-variable) – Jason Antman Nov 23 '09 at 21:52
  • Or **go to the source**. **esr** is the maintainer of the Jargon File and the author of The New Hacker's Dictionary. http://catb.org/jargon/html/M/metasyntactic-variable.html – Dennis Williamson Nov 24 '09 at 00:06
1

The top-level unix directory names are largely influenced by how these systems were configured decades ago. Here's a quick run-down of the more common ones:

  • /bin/ - programs that are part of the "core" of the system, i.e. required at startup
  • /boot/ - files requried during the boot process of the system (such as the kernel)
  • /dev/ - device nodes (placeholder files representing devices such as disks)
  • /etc/ - your configuration files
  • /home/ - directories belonging to actual users
  • /lib/ - shared librararies and other files that are part of the installed programs, but not directly runnable.
  • /sbin/ - same as /bin, but should only be run by root.
  • /tmp/ - temporary files (anyone can use this directory)
  • /usr/ - files that aren't system-critical, but are part of the system.
  • /var/ - files that change, but should be retained between boots

Traditionally, /usr was actually mounted as a network filesystem once the system was operational. So /bin and /sbin (which were stored on the local machine) only contained the stuff necessary to get that remote access up and running. /usr/ in turn contains elements of the "standard" directory tree, including /usr/bin/, /usr/sbin/, /usr/lib/, /usr/etc/, etc.

In the same way, /usr/local/ contained a set of programs, files, etc., that were "local" to a given installation, i.e. not part of the standard distribution. Again, expect to see /usr/local/bin/, /usr/local/lib/, etc. On a newly installed machine, those directories should be relatively empty, and it's a pretty safe place to install your own programs without creating any conflicts with the base system.

Traditionally, /tmp/ was erased upon boot, so stuff put there shoudn't need to stick around. /var/ on the other hand, contains a more permanant storage area. Things that end up under /var/ include database files, log files, and mail boxes.

If all the packages on your system are well-behaved, you should be able to put the entire system on read-only media (such as a CD), except have /var/ (and maybe /home/) be on a writable device, and /tmp/ be a ramdrive.

tylerl
  • 14,885
  • 7
  • 49
  • 71