Skip to main content

Linux directory structure explained: /etc, /var, /home, /tmp, /usr

Linux organizes files into directories by purpose. Understanding these directories makes it much easier to navigate and manage a Linux server.

/etc – Configuration Files

The /etc directory contains system-wide configuration files. Most installed services keep their configuration here.

Examples:

  • /etc/ssh/ – SSH configuration;

  • /etc/nginx/ – Nginx configuration;

  • /etc/passwd – user account information;

  • /etc/fstab – filesystem mount settings.

You will often work with /etc when configuring a Linux server.

/var – Variable Data

/var stores files whose contents regularly change while the system is running.

Common locations:

  • /var/log/ – system and service logs;

  • /var/www/ – commonly used for website files;

  • /var/lib/ – application data;

  • /var/spool/ – mail, print, and other queues.

For example, when troubleshooting a service, /var/log/ is usually one of the first places to check.

/home – User Files

The /home directory contains personal directories for regular users.

For a user named "name": /home/name/

This directory can contain documents, downloads, scripts, SSH-related files, and user-specific application settings. The root user's home directory is different: /root/

/tmp – Temporary Files

/tmp is used by applications and users to store temporary files. Files here should not be considered permanent. Many Linux systems automatically remove old /tmp files during reboot or through scheduled cleanup.

/usr – Programs and Shared Resources

/usr contains many of the programs, libraries, and shared resources installed on the system.

Important locations include:

/usr/bin/ User commands and programs

/usr/sbin/ System administration programs

/usr/lib/ Libraries

/usr/share/ Shared application data

/usr/local/ Locally installed software

For example, commands such as nano, curl, or git will commonly have their executable files under /usr/bin/.

Knowing these five directories gives you a solid foundation for navigating Linux VPS and server environments.

Did this answer your question?