Var folder in linux

The /var Directory

/var is a standard subdirectory of the root directory in Linux and other Unix-like operating systems that contains files to which the system writes data during the course of its operation.

The root directory is the directory that contains all other directories and files on a system and which is designated by a forward slash ( / ). Among the other directories that are usually installed by default in the root directory are /bin, /boot, /dev, /etc, /home, /initrd, /lib, /lost+found, /misc, /mnt, /opt, /proc, /root, /sbin, /tmp and /usr.

/var is specific for each computer; that is, it is not shared over a network with other computers, in contrast to many other high-level directories. Its contents are not included in /usr because situations can occur in which it is desired to mount /usr as read-only, such as when it is on a CDROM or on another computer. /usr, which is generally the largest directory (at least on a newly installed system) and is used to store application programs, should only contain static data.

Among the various subdirectories within /var are /var/cache (contains cached data from application programs), /var/games (contains variable data relating to games in /usr), /var/lib (contains dynamic data libraries and files), /var/lock (contains lock files created by programs to indicate that they are using a particular file or device), /var/log (contains log files), /var/run (contains PIDs and other system information that is valid until the system is booted again) and /var/spool (contains mail, news and printer queues).

Created February 25, 2006.
Copyright © 2006 The Linux Information Project. All Rights Reserved.

Источник

What goes in /var?

I read The Linux Command Line by William Shotts, and there are some descriptions of Linux files (system directories):

The /var directory contents don’t change. This tree is where data that is likely to change is stored. Various databases, spool files, user mail, etc. are located here.

I am wondering: If the /var directory contents are not supposed to change, why is there a www directory in /var/www after installing apache-php ? The /var/www directory is where we must edit, create or delete files. This is a localhost public directory. Why did he say, that the /var directory contents don’t change?

Читайте также:  Открываем txt в линукс

«don’t change. This tree is where data that is likely to change» — the quote is self-contradictory

Is this really what it says in your book? What I can find on page 23 in «The Linux Command Line» version 17.10 by William Shotts makes more sense: «With the exception of /tmp and /home, the directories we have looked at so far remain relatively static, that is, their contents don’t change. The /var directory tree is where data that is likely to change is stored. Various databases, spool files, user mail, etc. are located here.»

5 Answers 5

That description of /var is self-contradictory. /var contains things that are prone to change, such as websites, temporary files ( /var/tmp ) and databases. The name is an abbreviation of «variable».

@Sandeep I think the accepted answer is chosen by the person who asks the question. This person may not have had enough information before they chose an accepted answer. Generally speaking, answers with more votes will help more people. I suggest reading the comments below each answer, and follow any links provided by the answer’s author before making your decision. In my opinion, for this question, the accepted answer is incorrect.

Change can occur in more than one way. Variable files may change in size (footprint) or possibly quantity. Use /var if you have a set number of files which may be growing (i.e. due to log appending or rotation) over time so as not to run out of disk space.

From man hier , which has a «description of the filesystem hierarchy:»

/var This directory contains files which may change in size, such as spool and log files.

/var/account Process accounting logs (optional).

/var/adm This directory is superseded by /var/log and should be a symbolic link to /var/log .

/var/backups Reserved for historical reasons.

/var/cache Data cached for programs.

/var/cache/fonts Locally-generated fonts (optional).

/var/cache/man Locally-formatted man pages (optional).

/var/cache/www WWW proxy or cache data (optional).

/var/cache/ Package specific cache data (optional).

/var/catman/cat4 or /var/cache/man/cat4 These directories contain preformatted manual pages according to their man page section. (The use of preformatted manual pages is deprecated.)

/var/crash System crash dumps (optional).

/var/cron Reserved for historical reasons.

/var/games Variable game data (optional).

/var/lib Variable state information for programs.

/var/lib/hwclock State directory for hwclock (optional).

/var/lib/misc Miscellaneous state data.

/var/lib/xdm X display manager variable data (optional).

/var/lib/ Editor backup files and state (optional).

/var/lib/ These directories must be used for all distribution packaging support.

/var/lib/ State data for packages and subsystems (optional).

/var/lib/ Packaging support files (optional).

/var/local Variable data for /usr/local.

/var/lock Lock files are placed in this directory. The naming convention for device lock files is LCK.. where is the device’s name in the filesystem. The format used is that of HDU UUCP lock files, that is, lock files contain a PID as a 10-byte ASCII decimal number, followed by a newline character.

/var/log Miscellaneous log files.

/var/opt Variable data for /opt .

/var/mail Users’ mailboxes. Replaces /var/spool/mail .

/var/msgs Reserved for historical reasons.

/var/preserve Reserved for historical reasons.

/var/run Run-time variable files, like files holding process identifiers (PIDs) and logged user information (utmp). Files in this directory are usually cleared when the system boots.

/var/spool Spooled (or queued) files for various programs.

/var/spool Spooled (or queued) files for various programs.

/var/spool/at Spooled jobs for at(1) .

/var/spool/cron Spooled jobs for cron(8) .

/var/spool/lpd Spooled files for printing (optional).

/var/spool/lpd/printer Spools for a specific printer (optional).

/var/spool/mail Replaced by /var/mail.

/var/spool/mqueue Queued outgoing mail (optional).

/var/spool/news Spool directory for news (optional).

/var/spool/rwho Spooled files for rwhod(8) (optional).

/var/spool/smail Spooled files for the smail(1) mail delivery program.

/var/spool/uucp Spooled files for uucp(1) (optional).

/var/tmp Like /tmp, this directory holds temporary files stored for an unspecified duration.

/var/yp Database files for NIS, formerly known as the Sun Yellow Pages (YP).

Источник

Читайте также:  One sided printing linux

What is the var directory in Linux?

/var is a standard subdirectory of the root directory on Linux and other Unix-like operating systems that contains files to which the system writes data during the course of its operation.

/var contains variable data files. This includes spooling of directories and files, administrative and registry data, and transient and temporary files. Some parts of /var cannot be shared between different systems. For example, /var/log, /var/lock, and /var/run.

What is the var lib directory in Linux?

/var/lib is indeed the correct directory; as described in the file system hierarchy standard, this hierarchy contains status information about an application or system. State information is data that programs change while they are running and that belongs to a specific host.

Can I delete the var folder in Linux?

Most files, but not all in /var/cache are safe to delete. Do not delete the directories or change their ownership. Run /var/cache/* | sort -n to see what is taking up space. Ask here if you don’t know if large directories are safe to clean.

What are var files?

VAR is a document file format used by various software development programs. VAR files store programming constructs called variables. VAR files are used to store information about identifiers, values, and contexts.

What happens if the VAR is full?

Barry Margolin. /var/adm/messages cannot grow. If /var/tmp is in the /var partition, programs that try to create temporary files there will fail.

Does VAR need partitioning?

If your machine will be a mail server, you may need to do /var/mail a separate partition. Often it’s a good idea to put /tmp on its own partition, say 20-50MB. If you’re setting up a server with many user accounts, it’s usually good to have a separate, large /home partition.

Читайте также:  Настройки операционной системы линукс

How do I use Linux?

Their distributions come in GUI (graphical user interface), but basically, Linux has a CLI (command line interface). In this tutorial, we will cover the basic commands that we use in the Linux shell. To open the terminal, press Ctrl+Alt+T in Ubuntuor press Alt+F2, type gnome-terminal and press enter.

Источник

Оцените статью
Adblock
detector