Table of Contents

A Look Inside Linux series

A series of short topics on how Linux works and how to make it work the way you want it to, which I present during the weekly sessions of the Linux User Net. The target audience is Hams who are new to Linux and want to know more about it, as well as experienced Linux users who can learn more about their chosen operating system. These are my notes for the presentations. (Russ, KC7MM)

14. The Linux file system 2: Where to find things

Introduction

Last time we talked about what the Linux file system is. We saw that Linux has a single file system, and that everything on the computer is accessed through it. By “everything” I mean all software and hardware, both installed on the host itself and external to it (such as networked hosts).

That means that, as a user, you need to know where in the file system you can find the things you use. That's our topic for today.

Instead of going over the entire file system, we'll stick to the parts that you're most likely to use. If you want to know more, there's lots of material on the Web, such as this post.

File system structure

The Linux file system has a tree structure. The single point where the tree originates is called the root directory, and is designated by a forward slash character: /.

Everything else in the tree is located in branches, or subdirectories that come off of the root. The first level of subdirectories is set by default by the system. They are designed to contain various functions a Linux system performs to do its work. For example,

The three-letter names of most of these directories is a result of Linux's Unix legacy.

There is no official standard for this structure or for the names of the subdirctories – that is determined by the developers of Linux distributions. However, there are many benefits to be gained by employing a common structure, and so distros tend to follow the general structure that originated in Unix, with some variations to meet specific needs.

I have yet to see a distro that doesn't have /etc and /home and /usr, along with a number of others.

Commonly-used directories

/home/<username>: Home directory for users

This is for users who are granted a login and an interactive shell – you, for example. The home directory is where users can make and store files for their own use.

/etc for configuration

/etc is the location of system configuration files.

/dev for devices

We've seen previously how Linux enables hardware devices through device drivers that connect them to directories in the Linux file system. These directories are subdirectories of /dev.

I plan to devote another “Look inside Linux” to /dev, so I won't go into detail here. For now, I'll note that:

/usr for applications programs

Application programs let us do the things for which we run a computer. From email to wsjt-x, these applications are the software we work with.

The /usr directory is where the files that make up applications are installed: executables, configuration, images, documentation.

/var for application data

  1. /var/… subdirectories are used by programs to store their data. These generally are applications that run as services, for example:
    • Database management systems store their data (PostgreSQL, MariaDB).
    • Web servers store content: HTML pages, scripts, images, Web applications (Apache, Nginx)
    • Docker server stores images and local disk files.
  2. /var/log is where the system stores logs.

In conclusion

The Linux file system has many first-level subdirectories but, as a user and system administrator, you're likely to find yourself working with only a few of them – the ones we have covered here.

Now you know where to look for things in the file system. The next step is to understand how they are set up to work as they should. It's actually quite simple: users are given access to the bits of the file system they need to use, while being kept out of the rest of it.

We'll look at how that's accomplished in our next look inside Linux.

Return to series index