Kahibaro
Discord Login Register

`/var`

Purpose of `/var`

/var stands for “variable.” It contains files that change over time while the system is running. Unlike many parts of the filesystem that stay relatively static (like programs in /usr/bin), /var is where Linux stores:

Because the contents of /var grow and change, it’s a common source of disk usage problems and is important for troubleshooting.

Typical Layout Inside `/var`

Exact contents can vary by distribution, but you’ll usually see directories like these:

You don’t need to memorize all of these immediately, but it helps to have a rough idea what lives where.

`/var/log`: Logs

This is the most important subdirectory for basic administration and troubleshooting.

Common things you might find:

Typical beginner uses:

    tail /var/log/syslog
    tail /var/log/auth.log
  sudo tail -f /var/log/syslog

Permissions are usually restricted; you’ll often need sudo to read many log files.

`/var/cache`: Caches

Caches speed things up by storing data that can be regenerated if removed.

Examples you might see:

Key ideas:

  sudo apt clean
  sudo dnf clean all

`/var/tmp`: Long-Lived Temporary Files

Both /tmp and /var/tmp store temporary data, but:

Programs use /var/tmp for:

For a beginner:

`/var/spool`: Queues and Spools

A “spool” is a directory where data waits to be processed. /var/spool contains queues for services.

Common subdirectories:

Typical beginner relevance:

`/var/lib`: Service Data and State

/var/lib holds persistent data used by services and applications — usually not user documents, but internal service state.

Examples include:

Important points:

`/var/run` and `/run`: Runtime Data

On many modern systems:

These hold:

Files here:

As a beginner, you may see these mentioned in documentation or error messages, but you rarely need to edit them directly.

`/var/lock`: Lock Files

Lock files help ensure that only one process uses a resource at a time.

Typical purposes:

For most day-to-day use:

`/var` and Disk Space Problems

Because so many growing files live under /var, it’s a common culprit when your disk gets full.

Symptoms of a full /var partition:

Basic checks:

  df -h
  sudo du -sh /var/*

Beginner-friendly cleanup approaches:

Backups and `/var`

When thinking about what to back up:

This distinction helps when planning backups or troubleshooting space usage.

Summary

Views: 19

Comments

Please login to add a comment.

Don't have an account? Register now!