Amateur Radio with KC7MM
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)
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.
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,
/etccontains configuration data.
/homeis for user data storage.
/devis for devices, such as disk drives and I/O ports.
/varcontains data used by programs.
/usrfor application program binaries and related files.
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
/usr, along with a number of others.
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.
/homealso is created and given the user's username. For example, a user named “rufus” would be assigned the home directory
/home/rufus/myfilecan be referred to as
~/myfileby user “rufus”.
/etc is the location of system configuration files.
sudo, or – dangerously – by becoming root with the
sucommand. (More about this at another time.)
/etc/hostsfile to get easy access to hosts on my network using only the hostname.
/etc/network/interfacesfile to set a fixed IP address for the host – particularly for servers.
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
I plan to devote another “Look inside Linux” to
/dev, so I won't go into detail here. For now, I'll note that:
/devdirectory, for example a USB port at
/devdirectory to another point in the file system. This allows you to do things such as mounting a drive as a subdirectory in your home directory. For example, a solid-state-drive located at
/dev/nvme0could be mounted to and accessed through the directory
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.
/usr directory is where the files that make up applications are installed: executables, configuration, images, documentation.
which bash. The result should be
/usr/sharedirectory contains the other components that constitute applications: documentation, default configurations, icons and other images – and more.
/var/…subdirectories are used by programs to store their data. These generally are applications that run as services, for example:
/var/logis where the system stores logs.
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.