Skip to content
CBT Nuggets

Understand Linux Fundamentals

This skill, led by John McGovern, provides a comprehensive overview of Linux system management, focusing on the Filesystem Hierarchy Standard (FHS). It covers essential directories such as /dev, /proc, /sys, and user-specific directories like /home and /media. The skill also delves into system binaries and programs, explaining the roles of directories like /bin, /sbin, and /usr. Learners will gain a solid understanding of how to navigate and manage Linux file systems effectively.

Full lesson from Administering Linux Servers. Preview the IT training 23,000+ organizations trust.

49m 8 Videos 7 Questions

Skill 1 of 19 in Administering Linux Servers

Overview

Join John McGovern as he explains and demonstrates core fundamental concepts and practices relating to Linux system management

Recommended Experience

  • None

Related Job Functions

  • Systems Admin
  • Systems Engineer

A former CBT Nuggets learner, John used online IT training to help him build a diverse skill set, which includes networking and cybersecurity.

Introduction

Let's talk about what we plan to learn about the Linux file system in this skill!

FHS Basics

Let's discuss of the basic fundamental concepts behind the Filesystem Hierarchy Standard!

Knowledge Check

(True or False) All Linux distributions must strictly adhere to the Filesystem Hierarchy Standard.

Verify your team's readiness — Request a Demo to verify practice assessments, completion reporting, and CSV / SCORM exports on the Team plan.

FHS System Files and Directories

Let's look at some of system files and directories within the Filesystem Hierarchy Standard!

Knowledge Check

In which directory would you expect to see log files?

  1. A/var
  2. B/lib
  3. C/boot
  4. D/etc

Verify your team's readiness — Request a Demo to verify practice assessments, completion reporting, and CSV / SCORM exports on the Team plan.

The Dev Directory

Let's now explore the /dev directory!

Knowledge Check

Which of the following outputs would refer to the 1st partition of the 1st hard drive connected to the system?

  1. A/dev/sda1
  2. B/dev/sd1a
  3. C/dev/sda01
  4. D/dev/sda11

Verify your team's readiness — Request a Demo to verify practice assessments, completion reporting, and CSV / SCORM exports on the Team plan.

The Proc Directory

Let's now turn our attention to exploring the /proc directory!

Knowledge Check

(True or False) The /proc directory is a virtual directory created on the hard disk.

Verify your team's readiness — Request a Demo to verify practice assessments, completion reporting, and CSV / SCORM exports on the Team plan.

The Sys Directory

Let's /sys directory is a virtual file system that holds many important files for our system - let's explore it!

Knowledge Check

(True or False) The /sys directory contains files relating to kernel modules.

Verify your team's readiness — Request a Demo to verify practice assessments, completion reporting, and CSV / SCORM exports on the Team plan.

FHS User Files and Directories

Let's now turn our attention to the user files and directories in our system!

Knowledge Check

Which of the following is designed to be used to mount temporary file systems?

  1. A/mnt
  2. B/media
  3. C/root
  4. D/tmp

Verify your team's readiness — Request a Demo to verify practice assessments, completion reporting, and CSV / SCORM exports on the Team plan.

FHS System Binaries and Programs

Let's now look at our last grouping within the Filesystem Hierarchy Standard, the system binaries and programs!

Knowledge Check

(True or False) The /opt directory is there to contain optional third-party packages.

Verify your team's readiness — Request a Demo to verify practice assessments, completion reporting, and CSV / SCORM exports on the Team plan.

Conclusion

I hope this has been informative for you and I would like to thank you for consuming.

View Transcript

Introduction

0:12Hey, everyone, and welcome back to another skill.

0:15Within this skill here, we're going

0:17to look at how we can identify and locate

0:19system files and directories.

0:21Specifically, we're going to be taking a great interest

0:24in the /dev directory, as well as the /proc directory,

0:29and the /sys directory.

0:31Now, once we have explored our system files and directories,

0:34we're then going to pivot and then have a look

0:36at some of the user files and directories on the system.

0:40And then once we have done this, we're

0:41going to close by learning where we can find system binaries

0:45and programs within our directory structure.

0:48So really, we have a lot of very cool stuff

0:50to get to within this skill.

0:51Now, before we start, just to ensure

0:53that you are absolutely comfortable working at home,

0:56following along with this lab, what I just want to do

0:58is to highlight to you how you can quickly

0:59set up your terminal window to suit your needs.

1:02As you may see here, the output that I'm looking at

1:05is a little bit small.

1:07If I want to be able to adjust the font so it's

1:09nice and easy on my eyes, the way I can

1:11do this is that-- in fact, let me just close this

1:13down for a second here.

1:15I'll go down to the bottom left here.

1:16Just type in Terminal.

1:18Choose this one right here.

1:20I will have the Maximize icon.

1:21And then I'm going to go to this hamburger icon right here.

1:24If I then choose Preferences and I go down to Unnamed--

1:29that's just going to be my current profile--

1:30what I can do here is I can select a custom font

1:34and then click here.

1:35And basically, I can choose the font that I want.

1:38Let's maybe go into Ubuntu Mono, but I

1:40want the font to be bigger.

1:42So let me just arrow up [INAUDIBLE] get that bigger.

1:44If I then choose Select, we can see, here,

1:47immediately the text is bigger.

1:48If I want to change the color, I can uncheck the Use Colors

1:52from System theme.

1:54And then basically, I can choose the color that I want.

1:56So maybe I want to have black on white or gray on black.

2:00If you want to be a master robot-style hacker,

2:02you can do the green on black.

2:04Then all your text is now in green.

2:06So for now, all I'm going to do is

2:08I'm going to set my preferences as I'll

2:10have that white on black.

2:11And know that I'm happy and comfortable

2:13with my terminal setup, what I'm ready to do

2:15is to begin labbing.

2:17The very first thing that we're going to talk about

2:19is the basic pane-- something called the FHS.

2:22What on Earth is that?

2:23Well, that's what I'll be talking

2:24about in the very next Nugget.

2:25But for now, I hope this has been informative for you.

2:27I'd like to thank you for viewing.

FHS Basics

0:12Hey, everyone, and welcome back.

0:14So in this Nugget right here, what I want to talk to

0:17you about is something called the Filesystem Hierarchy

0:21Standard, otherwise known as the FHS.

0:25So what exactly is the Filesystem Hierarchy Standard?

0:28Why do we want to know what this is and what it does for us?

0:31Well, the clue is in the name.

0:32It's all about how our file system is going to be laid out.

0:35It's going to be laid out-- any particular hierarchy.

0:38And this is something that is standardized.

0:41Now, I will say, standardized, in a kind of loose way.

0:44This is something that is not mandatory.

0:46Not all Linux systems have to implement the FHS.

0:50It's something that is looked at is more of a good practice,

0:53or maybe, should I say, general consensus.

0:56Quite simply, if you happen to boot up

0:58your Linux-based operating system,

1:00there is a high degree that the file system

1:02is going to follow this particular format.

1:04Now, you will see, in other Linux filesystems,

1:06additional directories, maybe things

1:08look a little bit different here and there.

1:10But very, very broadly these are the components

1:13that are going to make up the filesystem that you

1:16would interact with.

1:16So realistically, what we have to understand here

1:19is what exactly comprises of the Filesystem Hierarchy

1:22Standard, what of the directories involved here,

1:25and what is the purpose of each of those directories

1:27because the reality is they really are quite specific,

1:31which honestly makes sense the management much, much

1:33easier because once you learn what the Filesystem Hierarchy

1:36Standard is, you are pretty much going

1:38to know exactly where to go to solve the problem that you're

1:41looking for.

1:41Whether you're trying to mount a device within the file system

1:44or whether you want to happen to try to identify which devices

1:48are connected to your machine, knowing

1:50the layout of the filesystem is going

1:52to be very, very beneficial.

1:53Let me give you an example of one of the big distinctions

1:56of the Linux filesystem.

1:58Compare this to how it works on say, for example,

2:01a Windows-based system.

2:03Well, the file system is directly

2:05tied to the physical hard drive.

2:07What do I mean when I say that?

2:08Well, if you happen to come from a Windows-based system,

2:11you may happen to have a C drive as well as a D drive.

2:15Now, if you wanted to locate--

2:17say, for example-- the Downloads folder within your C drive,

2:20you would follow a very particular path.

2:21It would be something like-- say you go into the C drive,

2:24and then you go into the Users directory,

2:26and then you would have your user name, such as John,

2:29and then you would have your Downloads folder.

2:32Now, the crucial thing to note here

2:33is that this folder is explicitly

2:36within the boundaries of this physical drive.

2:39You see that?

2:39And similarly, if you went onto the D drive,

2:41you would have a same thing.

2:43Whatever path you ended up, that would belong

2:44to this particular drive.

2:46That is not necessarily the case when

2:48it comes to Linux directories.

2:50Instead, when you happen to navigate the Filesystem

2:53Hierarchy Standard, quite honestly,

2:55the physical hardware that is holding the data

2:57is completely abstracted away from you

3:00due to the way the disk may or may not be partitioned.

3:03You may go on to say, for example, the Downloads

3:06directory here.

3:07And you could be accessing data on one hard disk,

3:10and then you just change into another directory-- say,

3:12for example, the Documents directory,

3:14and suddenly you are accessing a completely different disk.

3:17Or maybe the Downloads directory and the Documents directory

3:21are on the same disk.

3:22The point is you can explicitly just

3:24tell, simply by looking at the directory path, so to speak,

3:28the same way you could on a a Windows-based system.

3:31So what I mean when I say that is if I go into Documents,

3:34I could be on one disk, whereas if I go into Downloads,

3:37I could be on a completely different disk.

3:39It is completely transparent to the end user.

3:42Now, there actually are particular ways,

3:43that we will get to see later on within this course--

3:46how to determine where exactly all the filesystems are

3:49physically mounted.

3:50But the point is is that you as the end user,

3:53just going about your job, day to day--

3:55it's all very smooth and transparent.

3:58So what we're going to do within this skill

4:00is we're really going to focus in on the structure

4:03of this standard.

4:04Now, one thing I just want to say

4:06is that if we happen to go back and I type in the command man

4:09hier and hit Enter, this is going

4:11to give me a very comprehensive summary of all

4:15the different endpoints that you can find within this directory

4:17structure.

4:18We can see, here, there are a ton of different options.

4:21What we have to understand, for the purposes

4:23of the examination, is not absolutely every single thing

4:26that you see here, thankfully.

4:27But there are some core components

4:28that we want to know about.

4:30Now, before we begin, one point that I just want to make really

4:33quite clear-- because it can be a little bit confusing if you

4:36are just getting started with Linux--

4:39we have this concept of the routes of the filesystem.

4:43Now, that is located at this particular point.

4:45If I do cd forward slash and hit Enter,

4:48now I'm in the root of the file system.

4:51We can actually see this here.

4:52There's a little forward slash icon in the prompt.

4:54And if I do an ls to list my directory structure,

4:58these are the components of the Filesystem Hierarchy Standard

5:01that we are going to focus in on.

5:02So this point here is the root file system.

5:06And as we're going to learn here,

5:07we also have this root directory.

5:10These are absolutely not the same thing at all.

5:13We will certainly get to talk about the differences

5:15later on within this skill.

5:17But really before we get going, just

5:19understand that this here-- what we're talking about--

5:22is at the root of the tree, meaning that everything

5:25that you see here all belongs within this directory here.

5:28So now that we've discussed the absolute basics

5:30around the Filesystem Hierarchy Standards

5:33and we have navigated to the root of the tree, how

5:36about we talk about the particular components

5:38that make up this Filesystem Hierarchy Standard.

5:41And the first thing that we want to be looking at

5:43relate to System Files and Directories.

5:45And well, that's we're going to be talking

5:47about in the very next Nugget.

5:48So I hope this has been informative for you,

5:50and I'd like to thank you for viewing.

FHS System Files and Directories

0:00[AUDIO LOGO]

0:12Hey, everyone.

0:13And welcome back.

0:14Now, previously, we had just introduced

0:16some of the most basic concepts around the file system

0:19hierarchy standard.

0:20What we now want to do is to look

0:21at some of these system files and directories within the fsh.

0:25So with that said, let's dive in and begin.

0:29So as we know, we're at the very rich of a tree here.

0:32And we have all of these different directories

0:34to explore.

0:35The very first directory that I'm going to show you

0:38is going to be the boot directory.

0:40So if I do CD and go into boots, and hit Enter,

0:44this is where all the files, which

0:46are needed for your system to boots are located.

0:49So you're going to see things such as the kernel

0:51image, bootloader files, the initial RAM disk image,

0:54as well as files just relating to your kernel configuration.

0:57We can see here config 5.15.0.67.

1:00That here tells us the particular kernel version.

1:03And that is going to contain like, I say,

1:05particular configuration settings.

1:07Here, we can see the initrd, the initial RAM disk

1:10image for this particular kernel version, as well.

1:13Notice they match up right here and here.

1:15And the initial RAM disk is actually

1:17going to be used by the Linux kernel.

1:19When the system is putting up to allow

1:21us to load all the particular modules,

1:23it needs as well as all the associated drivers.

1:26Now, if we look at this particular directory here,

1:28grub.

1:29That contains all of the files needed by the grub bootloader.

1:33Now, we actually haven't discussed the grub bootloader

1:36quite just yet.

1:37But don't worry.

1:37We'll get to that very, very shortly.

1:39Just understand that it's just relating to the booting

1:42up of our system.

1:43And these particular files can be located

1:46within the boot directory.

1:48Now, we also see this vmlinuz.

1:50And that is linuz with a Z not an X.

1:53That's just basically your Linux kernel executable file.

1:56Once again, like I say, located within the boot directory.

1:59And one thing to note here is that when

2:01you happen to see a Z here, that actually

2:04tells you that this is the compressed version

2:06of the executable file.

2:07Whereas, if it says vmlinux with an X,

2:11that tells you that you have the uncompressed version.

2:14Just a bit of trivia in the case of,

2:16perhaps, maybe, say, an examination question.

2:18So without going into too much detail to early, the boot

2:21directory, like I say, this is just full

2:23of files needed to boot the system.

2:25The next directory I want to go to

2:27is I apply CD root to go back to the root of the tree.

2:29And I go into the eetc directory here.

2:32Quite simply, this is where your system's configuration files

2:36are located.

2:37We see a lot of dot confs here, for example.

2:39One thing to note here is that all of these blue files,

2:42we can see here, these happen to be

2:43directories, which contain even more subdirectories or files.

2:47And the white ones here are simply

2:49just the files themselves.

2:50So let's say I wanted to make some configuration

2:52changes to the networking on my system, where I would go

2:56would be into the etc directory.

2:58And then I could go into netplan.

3:00And then I can modify this particular YAML file.

3:03So right now, we can see here that my ethernet interface

3:06is effectively getting its IP address automatically

3:10via protocol known as DHCP.

3:12But if I so wish, I could specify a particular address,

3:15specify a particular gateway, or DNS servers.

3:19And like I say, this configuration change

3:21would happen within the etc directory.

3:24And there are way, way, way more examples than just

3:26simple network configurations.

3:28But let's move on.

3:29So the next directory is going to be the Lib

3:32directory at figure 1 here.

3:34Essentially, this is where all the important libraries

3:37that your system needs to operate are located.

3:40So we have libraries, such as apt,

3:42which is used for package management or cups,

3:44which is used to handle our printers.

3:46Or we can see here, we have libraries

3:49relating to the Python programming language.

3:51Or if we want to be able to listen to music on our system,

3:54we can use rhythm box, or perhaps

3:57work with some documents using libreoffice.

3:59All of these libraries are located right here in Lib.

4:03Now, the next one that I want to talk to you about, let's

4:06go back to the root of the tree, clear the screen.

4:09The one here is this one right at the very end, the VAR

4:13directory.

4:13So within the VAR directory, that

4:15is going to be the home of your variable data.

4:18Hence, the name VAR.

4:19Pretty much think about data that is ever changing.

4:22So data that is growing in size or shrinking in size, data that

4:26is not static.

4:27So think of things such as logs or perhaps maybe

4:30email, whatever it may be.

4:31So say, for example, you wanted to see

4:33the logs for the booting of your system, where would you go?

4:36Well, you would to look within the VAR directory.

4:39And then within there, we can see we have this log directory

4:43here.

4:43We can go into this.

4:44So we can see things such as the message right here.

4:47That is going to contain all of our kernel messages.

4:50So if I just say cat on that particular file,

4:52here is all this kernel information.

4:54And if we go on up to the very top,

4:56we can actually see the boot process began to kick off.

4:58As you can imagine, details such as logging,

5:00it's going to be variable.

5:01It's going to be changing.

5:03That is why it's going to be located within the VAR

5:06directory.

5:07So those are some of the common system files and directories

5:09that we have to understand for the purposes of Linux

5:12plus examination.

5:13But the reality is, there are even more on the system.

5:16Ones that we have to look at with a little bit more detail.

5:19The very next one that we're going to be looking at

5:21is the dev directory.

5:22And well, that's what we're talking

5:24about in the very next Nugget.

5:25But for now, I hope this has been informative for you.

5:28And I'd like to thank you for viewing.

The Dev Directory

0:12Hey, everyone, and welcome back.

0:14Now previously, we talked about some of the main system fails

0:17and directories within the file system hierarchy standard.

0:21We talked about the boot directory, as well as the etc

0:24directory, then the lib directory,

0:26and then finally, the var directory.

0:28Now, there are more directories within this domain

0:31to explore but like I say, they do perhaps require a little bit

0:34more attention to detail.

0:36And as such, I'm choosing to split them up.

0:38The one that we're going to be looking at in this Nugget right

0:41here is the dev directory.

0:44This is a super important directory, and the reason

0:46why is that this is where your device files are located.

0:51What exactly do I mean when I say device files?

0:54Basically, if you want your system

0:56to be able to talk to some hardware, maybe

0:59a keyboard or a USB drive, the system

1:02itself is going to use these particular device

1:05fails to make that connection happen.

1:08Unfortunately, it can't just happen with pure magic.

1:10The system is going to lean on and rely on these files

1:13to make this work.

1:14If we happen to go to this particular directory right now,

1:17we do a cd into the dev directory.

1:20If I do an ls, look at all this information

1:23that we see right here.

1:24So let me give you a breakdown on the types of things

1:27that you can expect to see right here.

1:28You can expect to see things such as sda.

1:32As it transpires on my machine right here,

1:34that's virtual machine happens to be

1:36running an ARM-based image because I

1:38am using Apple Silicon.

1:39And as such, this particular convention is not showing up.

1:43Instead here, the way it's showing on my system as vda

1:48but depending on what you are running at home.

1:50If you're running the ARM-based architecture,

1:51you can expect to see VGA, whereas if you happen

1:53to be running a regular virtual machine, very, very likely

1:57you're going to see this particular convention.

1:59But whether you see it or you don't, we

2:01do want to understand what that says because that is very, very

2:04common within Linux systems.

2:06Simply put, when you see sd, you can

2:10think of this as a hard drive.

2:12Now, and all the systems you would expect to see hd,

2:14but the reality is in modern systems

2:16are much more likely to see sd.

2:18Now, let me tell you what the convention actually is here

2:20because it really does tell you about the physical device that

2:24is connected.

2:25If you happen to see sda, the sd part

2:29tells that you are dealing with a hard drive

2:32and the a tells you that you're dealing

2:34with the first hard drive on the system.

2:37Now, if you happen to have an additional drive attached,

2:39you could see that shown up as sdb, b being the second drive.

2:44And if you had a third, that would be sdc.

2:48Now, that is not all.

2:49The way, we see here whereas in my case here,

2:51it is substituted for a V as opposed

2:54to an S. Notice that actually is a number as well, OK?

2:58So in the case here, I've got vda1, vda2, and vda3.

3:03You may have sda1, sda2, and let's just

3:08focus on these for now.

3:09So straight away, we know sd hard drive, a

3:12tells us this is the first hard drive.

3:14But look below that is the exact same right here.

3:16Both are the first disk.

3:18But the crucial thing here is that this one here

3:20tells us that says the first partition,

3:23and this number two here tells us this

3:25is the second partition.

3:27So let's imagine you happen to have two disks attached.

3:30The first disk would be disk a, the second one would be disk b.

3:34If they were partitions, let's see your hard partition 1 here

3:38and partition 2.

3:39And let's see, this one here had three partitions, one here

3:43and a split here.

3:44You have 1, 2, and 3.

3:47If I said to you, "Point out to me sdb3."

3:52You would know that is the second disk right here

3:55and it would be the third partition.

3:57That's part right here.

3:58You see that?

3:59Whereas if I say sda2, you would know

4:03that the a tells you is the first disk but as

4:05the second partition that I'm talking about.

4:08And' like I say, this information

4:10whereby you could derive these insights into your disks

4:13and partitions could be found within the dev directory.

4:16Now, the reality that is not all.

4:18You may notice a whole ton of these tty entries.

4:21These are just quite simply device fails denoting

4:24either a terminal or a console.

4:26If you happen to log in via a terminal,

4:29that will spin up as a tty session

4:31and it will appear here within the dev directory.

4:34Similarly, you may have to have a USB connected, in which case

4:38you will see the device file for that particular device

4:41and dev/usb.

4:45Now, the dev directory also has some special device files.

4:49And these special device files are used

4:51for very particular operations.

4:53The very first one that I want to draw your attention to

4:56is dev null, OK?

4:59Now, this as a special device file

5:01that is going to allow you to basically discard

5:03any information that gets put into it.

5:06What do I mean when I say that?

5:07Well, take for example, this right here.

5:09Let's say I wanted to look at the etc password fail, OK?

5:14Now, right now, that opens.

5:15No problem at all, let's clear the stream.

5:18Now, let's try one where I would get permission denied.

5:20If I tried to open say, for example, the shadow file.

5:23And don't worry if you do not know what these failures are

5:26quite just yet.

5:27Again, we'll talk about that later on within this course,

5:29certainly within great detail.

5:31But just understand, when I try to open this file,

5:33it's saying permission denied.

5:35Essentially, I would have to have superuser privileges

5:38to read this particular file.

5:39Same if I also try to open the sudoers file.

5:42Try that one.

5:43You see that?

5:44Now, if I try to count all these together,

5:45if I say cat etc password, and etc shadow, and etc sudoers,

5:52if I hit Enter, we open the first file but at the very end,

5:56we have these permission denied.

5:57So quite simply, we have two errors within our output.

6:01Now, if you happen to be dealing with a lot of data

6:03whereby maybe half of it is giving you

6:05errors and half of it is valid, being

6:07able to easily sort through that data

6:10so that you can effectively discard the erroneous data.

6:13What you can do is you can invoke that special file dev

6:17null.

6:17So let me show you what I mean.

6:19What I'm going to do is I'm going to take any errors

6:21and I can do this using this particular syntax as the number

6:24two, and then the forward arrow.

6:26And all the two means is that if I happen to have an error,

6:28I want to move the error into a particular location

6:33and I want to move it into dev null.

6:35If I now do this, look at this right here.

6:37Any of the erroneous output has essentially

6:40been dumped into the bin and we're only

6:42getting the outputs of the commands

6:44that we are successful.

6:45Now, that's a very, very simple and stripped down example.

6:48But honestly, the use of the dev null

6:50special file as extremely useful for system administration.

6:54And just to close, that also as another file known

6:58as /dev/random.

7:02This really is a special file that

7:04is going to allow you to generate random data that you

7:07can give off to applications.

7:08This can be very good if you happen

7:10to need some type of random data generator.

7:12Perhaps you're invoking some type of encryption, or maybe

7:15some random password generator.

7:17By invoking this particular special file within the dev

7:20directory, you can have easy access

7:23to that type of functionality.

7:24OK.

7:25So that is us for our introduction

7:27into the dev directory.

7:28Remember, this is where our device files are located.

7:31So whether we are connecting to a hard disk, or a USB drive,

7:34or a keyboard, these files right here

7:37are the files are going to facilitate

7:39these types of operations.

7:40So the next directory that we're going to be looking at

7:43is the directory.

7:44And well, that's what we're talking

7:45about in the very next Nugget.

7:46So I hope this has been informative for you,

7:48and I'd like to thank you for viewing.

The Proc Directory

0:00[AUDIO LOGO]

0:12Hey, everyone.

0:13And welcome back.

0:14Now, previously, we talked about the dev directory.

0:17And we learned that this is where

0:19our device files are kept.

0:21Now, what I want to do is I want to talk to you

0:23about the proc directory.

0:25How about we dive in and get right to it then?

0:28So the very first thing to note about the proc directory

0:31is that this as a virtual file system.

0:33And when I see it is a virtual file system,

0:36don't confuse that, as some people do,

0:37thinking that it doesn't really exist.

0:39It absolutely does exist.

0:41The difference is that it exists within memory.

0:44But basically, when you boot up your system

0:47within memory, dynamically on the fly,

0:50this directory here is going to be created.

0:53Now, the question is, what information does it actually

0:56hold?

0:56Well, quite simply, this is going

0:58to hold information relating to say, for example,

1:01you're running processes.

1:02It will also have information relating to say,

1:05for example, your hardware configuration,

1:07as well as providing details about options

1:09passed into the kernel.

1:10Now, the first thing that I want to do

1:12is to talk to you about these process numbers.

1:15So check this out.

1:16If I go to my terminal here, and I'm going to type in a command

1:19we have not visited yet.

1:20Once again, this is still early days.

1:22Don't worry about the details too much.

1:24Just seat back with a coffee and relax.

1:26All I'm going to do is say, pse.

1:29Now, when I do this right here, all I'm doing

1:31is I'm listing all of the processes on my system here.

1:34So if I scroll on up through all of these processes,

1:37at the very top, we have the systemd process.

1:39And to the left, we have this PID.

1:43This is the process ID.

1:44Basically, a numerical value associated

1:48with a particular process.

1:49Now, see all of these numbers here.

1:52If I happen to go into the proc directory,

1:55but I'm actually going to see something quite interesting.

1:58So let's do that.

1:58And we CD into proc.

2:00If I do an ls, we can see all of these files here and wait.

2:04But look at all of these numbers here in blue.

2:07These are all directories, which are

2:09associated with those processes that we just saw there.

2:13So within these directories, what we can find

2:16are particular files that are going to provide information

2:19about that particular process.

2:21So within say, for example, this directory here, 15,

2:25we will find information about how much memory

2:27is being used by process 15, as process 15 opening

2:31particular files, so on, and so forth.

2:33And, again, if you want to check what

2:34that process happens to be, we can say, pse, scroll on up.

2:38We recognize the process here as migration, for example.

2:41Go into the directory here and find all

2:43the correlating information.

2:45Now, one thing to really note here is that, like I say,

2:48this here is a file system running in memory.

2:50And it is being dynamically updated in real time.

2:54Say, for example, I happen to run the ping command.

2:57If I just run ping here, and I open up a new window,

3:00if I do a pse right now, at the very bottom,

3:04we can see here we have the ping process running.

3:06And it is associated with process 8229.

3:10So now, if I do an ls here, notice in my output here,

3:13I actually have this process 8229.

3:16Let me just stop this here, control-C.

3:18And I clear the screen.

3:20If I do an ls again, notice that particular process

3:24is no longer there.

3:258229 no longer here.

3:27That is because that process has stopped.

3:30I interrupted it.

3:31And because of that, the process ID

3:33is not actually appearing within this directory.

3:35Again, we can confirm, pse, no ping output at all here.

3:39So this directory here as being updated dynamically.

3:42Now, like I said, the information

3:44is not just about particular process IDs.

3:46We also have other information say,

3:48for example, our interrupts.

3:50If I do cat interrupts and I scroll on up,

3:54this particular file here is really

3:56good for locating problems where say,

3:58for example device drivers or hardware.

4:00Because you can essentially see here,

4:02how many interrupts are happening, which processes

4:04are causing interrupts.

4:06And all of this can essentially be

4:08related to performance issues on your machine.

4:11Not just that, if I just clear the screen, once again,

4:14within the proc directory, I could also get information on,

4:17let's say, the file systems here.

4:19What I'm seeing here are all of the file systems

4:22that are supported by the kernel the time running on my system

4:25right now.

4:26So I can see things, such as ext4, fat-based file systems.

4:30And once again, we are still very early.

4:31We'll talk about what all of these file systems

4:33are in an upcoming skill within this course.

4:36But understand, if we want to find that list of file systems

4:39that are supported by our kernel that we are running right now,

4:43we can find out within the proc directory within the files

4:46systems.

4:47Similarly, let's say, I wanted to get information

4:49about the memory usage of my system

4:52within the proc directory that will be a file called meminfo.

4:56If I open this up, check this out right here.

4:59Let me scroll on up.

4:59I can see my total memory.

5:01I can see the memory, which I have free, all of the buffering

5:04caching, so on, and so forth.

5:06All of that is also available within the proc directory.

5:09Maybe I want to see some type of information about my networking

5:13connections and my networking interfaces,

5:15but within the proc directory.

5:16We also have another directory known as the net directory.

5:21We can see this right here.

5:22If I do a CD net, or rather CD net, should

5:25I say, for doing ls.

5:26We have all of this information relating

5:28to say ipv6 routes, or simple network management protocol

5:33or routing information.

5:34All of these, once again, within the proc directory.

5:37Now, to be honest, there is an absolute ton

5:39of information within this particular directory.

5:41But for the purposes of the examination,

5:44you really want to be remembering

5:45that this is a virtual file system holding stuff

5:48like kernel information, hardware information,

5:50as well as information on those running processes.

5:54That is it for our introduction into the proc directory.

5:57We'll get to look at a lot of the information

5:59that we've sought here within this directory

6:01in a lot more detail later on within this course.

6:03But for now, the next thing that I want to talk to you about

6:06is the sys directory.

6:08And well, that's what we're talking

6:09about in the very next Nugget.

6:10So I hope this has been informative for you.

6:12And I'd like to thank you for viewing.

The Sys Directory

0:00[AUDIO LOGO]

0:11Hey, everyone.

0:13And welcome back.

0:14Now, previously, we talked about the proc directory,

0:17which we learned was a virtual file system created in memory.

0:20The next file system that I want to talk to you

0:22about is the sys file system.

0:25Once again, also a virtual file system,

0:28also created in memory on the fly.

0:31The question is, what exactly does this sys file system

0:33provide us in terms of information?

0:35Well, let's talk about it and find out then, shall we?

0:37The type of information we're going to find within the sys

0:40directory is going to be information relating

0:42to kernel modules, as well as hardware and driver

0:46information.

0:46And like I say, that is all going

0:48to be information that we can update

0:50on the fly and real time.

0:53Now, one thing I should just state

0:54as a point of clarification is that the file

0:57system itself is actually known as sysfs, so sys file system.

1:03The crucial thing to note here is

1:04that sysfs is actually just mounted from and accessible

1:08from the sys directory.

1:10So a little detail there, but important to understand.

1:13So let's go and have a quick peek

1:15into this particular directory, shall we?

1:17So let's CD into sys after doing ls.

1:21As we can see here, we have a number of directories.

1:24Now, if we go into the first directory,

1:25we're going to block devices.

1:27But then here, we can see some loopback information,

1:30as well as, in my case here, vda,

1:33which happens to be my desk.

1:34And just for posterity, if I just quickly go to the nodes,

1:38and I create an Ubuntu system, just

1:40give it a very basic setup.

1:42So I'll just copy this configuration here.

1:44And I will log in.

1:45Let's just accept the fingerprint,

1:47type in my password.

1:48So now, I'm on the cloud-based machine.

1:50No longer within my ARM architecture.

1:53If I go into the sys directory here,

1:55do an ls, if I go in to block devices,

1:57ls here, as we can see here, in this case here, as expected,

2:01we can see two disks, SDA, the first disk, and SDB.

2:06So any type of hard drives or solid state drives information

2:10about those drives will be found within the block directory

2:13within the sys directory.

2:15Whereas, if I go back out, let's maybe go into,

2:18let's say, the kernel directory within sys.

2:20Inside of here, we're going to be

2:22able to find things such as the kernel version or perhaps

2:25the kernel configuration, so on, and so forth.

2:27Similarly, if I go back, do an ls,

2:29if I go in to say, for example, devices, inside of here,

2:33I'm going to be able to find network information, computer

2:36information, memory information relating to all the devices

2:40that are connected to my system.

2:42So let me just exit out of the cloud right now.

2:44Go back to my own virtual machine

2:45right here, which I have locally on my computer.

2:48Let's maybe go into devices here.

2:50If I do an ls, I could go into the system directory.

2:53Do an ls here, I can see information

2:55relating to memory or CPU.

2:58Let's go into the memory directory here.

3:00If I do an ls, I can see my block size base.

3:04And if I cut this open, I can see the value here,

3:06which is a hexadecimal value, which

3:09I think, if I recall correctly, correlates to 128 megabytes.

3:14But don't quote me on that.

3:15The value itself is not important.

3:17The point is as the F, I want to get this type of information,

3:20such as memory block size information relating

3:22to my device.

3:24Well as expected, I can find that information directly

3:27within the sys file system.

3:29So the key point here to remember

3:30is that the sys file system, once again, just like proc,

3:33as a virtual file system created a memory and updated

3:37on the fly and real time.

3:38It's going to contain information relating to kernel

3:41modules, hardware such as block devices, devices,

3:44which are attached to your system,

3:45and information such as power management and the status

3:48of your battery.

3:49All of that type of information will be located

3:52within the sys directory.

3:53So I hope this have been informative for you.

3:55And I'd like to thank you for viewing.

FHS User Files and Directories

0:00[AUDIO LOGO]

0:12Hey, everyone, and welcome back.

0:14Now previously, we had been focused on system files

0:17and directories within the file system hierarchy standard.

0:21Things like the boot directory or the lab directory.

0:23Or more recently, the dev, proc, SAS directories.

0:27What I now want to do, though, is

0:29to focus our attention more on the directories

0:32and files relating to users.

0:34So what exactly are the directories

0:36that we are going to focus on within this Nugget right here?

0:39Well, for a start, we'll be looking at the home directory,

0:42as well as the media directory.

0:45And then the mount directory, as well as the root directory.

0:50This is the one whereby there can be some confusion.

0:53And we'll also look at the TMP directory.

0:56So let's first begin by talking about the very first one

0:59at the very top here, the very well used home directory.

1:03So let's dive in and talk about them.

1:04OK.

1:05So if I do CD roots once again, I'm

1:08back to the root of the file system.

1:10If I go into this home directory right here,

1:13within this directory, there is going

1:15to be a directory automatically created with my username.

1:20So my username, as we can see here within the prompt,

1:22is IPvZero.

1:24If I do an LS, lo and behold, there

1:27is a directory here called IPvZero, after my username.

1:30And within that directory here, this

1:33is where I am in my home directory.

1:35And I can actually see here, within the prompt, this little

1:38tilde sign that actually lets you know that you're

1:41in your home directory.

1:43Now the purpose of this particular directory,

1:46is quite simply, this is your home.

1:47This is where you keep your own sample personal files.

1:51If I do an LS, we can see things such as documents.

1:54So if I've got some personal documents, such as my recipes,

1:58.txt.

2:00Maybe I've got some super simple but equally delicious

2:02pizza recipes, so pepperoni cheese and, I don't know,

2:07pizza dough.

2:07Well, I'm always quite lazy and just buy it.

2:10But there you go.

2:11Nevertheless, if I did happen to have my own recipe,

2:14will be storing that within my home directory

2:17and such a thing as my documents file.

2:19Of course, that is going to make much more sense

2:21than have that located in somewhere like, say,

2:23the boot directory.

2:24Similarly, we can also see within this directory,

2:27we have things such as our pictures.

2:29So if you happen to store any pictures,

2:31that should be a good directory for you.

2:33Or if you happen to have saved some videos, once again, this

2:38as the location you would want to save there.

2:40Now of course, there is nothing forcing

2:41you to follow this particular format.

2:44Indeed, if you decide, maybe I don't

2:45want to have a video directory, it's just a distraction for me,

2:49well, if I so wish, I can remove that.

2:52And if I do a listing now, suddenly that directory

2:54is gone.

2:55And maybe I would rather have a Linux study directory.

2:58Trying to be productive after all.

3:00The point here is that this is really

3:02a fully customizable workspace to meet your own needs.

3:05So as we move on, we go back to the roots of the tree.

3:09And we do a listing once again.

3:11We can see we have this media directory here.

3:14If we go in, we do an LS, we actually

3:16see nothing is in this directory.

3:18Now that is because this is going

3:20to be a location whereby you can mount and access

3:24removable media, things like DVDs or USBs,

3:27whatever it may be.

3:28That is going to be accessible within

3:31this particular directory.

3:32Now as it transpires, I don't actually

3:34have a USB connected to this device.

3:36After all, it is just a simple virtual machine.

3:38It's not a real machine.

3:39But I'm using it any real world way.

3:42But like I say, if you are running Linux in the real world

3:45and you do attach some type of USB stick,

3:48then the contents of that stick will

3:50be available via this particular directory.

3:52Now one thing I just want to point out to you,

3:55is that it might be a little bit confusing when

3:58you hear about having access to things like USB

4:01within the media directory because maybe you

4:04recall that we talked about a similar concept

4:06within the dev directory.

4:09Now the key distinction here is that the dev directory

4:13is where the device files for these devices are.

4:16So the files that actually facilitate these operations

4:20are located there.

4:21So if you attach a USB, the way that that

4:24can be essentially accessed was because a file

4:27was in the dev directory that facilitated that access.

4:30But once it has mounted and you actually

4:32want to access say, for example, the data on that USB,

4:36the media on that USB, the way you actually

4:39interact with that drive is going

4:40to be in the media directory.

4:43Now the next directory I want to show

4:44you is really, really similar once again but that

4:48has a distinction.

4:49So if we do an LS, we can see we have the mount directory.

4:52Now what we were just talking about with the media directory,

4:56we're saying how that can mount things like removable media,

5:00DVDs, USBs, and so on and so forth.

5:02So why on earth would we have a mount directory then?

5:06Well, the mount directory here is really for temporary mounts.

5:10And it really has a focus on temporarily mounting

5:13file systems.

5:14So if you happen to attach a file system that

5:17was mounted over the network, you

5:19would access that network drive via the mount directory.

5:24That is where you would want to mount that particular network

5:26share.

5:27Or perhaps if you wanted to access an external drive being

5:30used as a file system, again, you

5:32would want to mount that within the mount directory.

5:35Again, like I said, this is a temporary mounting point

5:37for file systems.

5:38It's going to be much more frequently used

5:40by technical people.

5:42Whereas the media directory, well, that

5:45is more used for the average user on the desktop.

5:48Say, for example, accessing media, mounting a DVD

5:51and watching it, say, for example.

5:53But these two can be quite confusing.

5:54But really try to draw a distinction here.

5:56One is really for accessing media.

5:58The other is just for temporarily

6:00mounting file systems.

6:01Now the next one is going to be, yep,

6:04maybe another confusing one, is going to be the root directory.

6:08Now you can see here, when I try to CD into this directory,

6:11it's telling me that the permission is denied.

6:14Maybe that will give you a clue as to what

6:15this directory is all about.

6:17Quite simply, the way we have this home directory here

6:21for the user IPvZero, well, the root account, i.e.

6:25the administrator of the system, also

6:27has this type of home workspace, so to speak.

6:30And the root directory is really just

6:33the root user's home directory.

6:34So if I want to be able to access

6:36this particular directory, what I would have to do

6:39would be to become the root user.

6:41So if I just log in as the administrator right here,

6:43notice now that I am the root user, I can say, who am I.

6:47We can see I am the root.

6:48If I do CD to take me to my home directory

6:51and I do a print working directory,

6:53we can see here that I am automatically now in the root

6:57directory right here.

6:58Now, this doesn't have the basic skeleton folder layout the way

7:01the home directory does, of documents, downloads,

7:03so on and so forth.

7:04But I as the root user, if I wanted

7:06to create such things, then of course,

7:08I could do that, no problem at all.

7:09I could just say, mkdir documents, do an LS.

7:12Suddenly I have that particular directory.

7:14So really this is just the workspace

7:16here for the root user.

7:18So let's go back and log in as my regular accounts.

7:21If I do a CD, I go back to my home directory.

7:25If I print the working directory, notice now

7:27I'm back within home IPvZero because as we see here,

7:30I am the user IPvZero once again.

7:32Now the last directory that I want

7:34to show you within this Nugget here

7:35is, if I go back to the root here

7:37and I now go into the TMP directory,

7:40now one thing to note here is that the TMP directory is

7:43colored a little bit different.

7:45Let me tell you this.

7:46The TMP directory is there for temporary files.

7:49And one of the caveats about this particular directory

7:52is that it has really, really relaxed permissions.

7:55Many directories, for example, will only

7:57allow you to read particular files within them.

7:59Some may even allow you to read and write particular files.

8:03But many will not allow you to actually execute

8:06particular files within them because of course, that

8:08could potentially be dangerous.

8:10The temporary directory though, is very, very relaxed

8:14in the respect that pretty much anyone can execute file

8:17from within this TMP directory.

8:19So after the file is located there,

8:21you can run it from there.

8:22So if I go into this directory here,

8:25all we're going to see here are a whole bunch

8:27of temporary files.

8:28And typically what would happen is

8:30that when you happen to reboot the system,

8:32the files here within this temporary directory

8:35are going to be deleted by particular startup scripts.

8:37It's not always the case, depending

8:39on the particular situation.

8:40But that is a very general behavior.

8:43And just one point to highlight about the potentially dangerous

8:46nature of this directory is that because

8:49of the relaxed permissions within this folder,

8:52this is often a folder utilized by hackers

8:54to break into a system.

8:56Because once they access this particular directory,

8:59they can actually have permission

9:01to run all these hacking scripts, such as bash

9:04scripts and Python scripts, to effectively attack and gain

9:07control of the system.

9:08So you've always got to be aware of that attack vector

9:11when managing your Linux system.

9:13Okidoke, so that is us for our basic introduction

9:16into the user files and directories

9:18on the Linux system.

9:19The next thing I want to talk to you

9:21about are these system binaries and programs.

9:23And well, that's what we're talking

9:24about in the very next Nugget.

9:26So I hope this has been informative for you.

9:27And I'd like to thank you for viewing.

FHS System Binaries and Programs

0:12Hey, everyone, and welcome back.

0:14Now, previously, we looked at the file system hierarchy

0:17standard user files and directories.

0:19Now, what you want to do is to focus in on these system

0:22binaries and programs within the file system hierarchy standard.

0:26So the directories that we're going

0:27to focus in on in this Nugget is going

0:29to be the bin directory, the opt directory, as well as the sbin,

0:34and user directories.

0:36So let's dive in and explore them, shall we?

0:39So the very first directory that we're going to explore now

0:41is going to be that bin directory.

0:43So once again, we go to the roots.

0:45If we do an ls, we can see here it resides right here.

0:48If I do a cd bin and I do an ls here,

0:52you may think the output that you see

0:54here is really quite familiar.

0:56Let me show you what I mean.

0:57If I scroll on up, you might see things such as ls or scrolling

1:01or not be a little bit further, you

1:03might see things like cp or cat.

1:06Or one we looked at earlier, ps.

1:08Indeed, what we are actually looking at here

1:11are the binary executables needed

1:13for our system to operate.

1:15And you may notice that the color of all of the items

1:18here looks a little bit different

1:19instead of seeing blue for the directory, or white for a file.

1:24Instead, here I'm getting a whole bunch of green.

1:26That's because these are executable files.

1:28So the bin directory has all of these binary executables.

1:31But next directory we are going to look at

1:33is the opt directory.

1:34If I just go into cd, into the root, do an ls.

1:38Here is this directory here.

1:39Let's go in to see the opt.

1:41If I do an ls here, nothing is actually here at the moment.

1:45And that's because this is where you're

1:47going to find optional, hence the name, software

1:50packages that are not required that you

1:52could get via third party.

1:53Quite simply, this gives us a nice little space

1:56whereby we can isolate these programs

1:58from the rest of the system, thus making it really easy

2:01for them to be removed again.

2:02So if you want to build a third party program from source,

2:06this is where you want to be putting those files.

2:08Now, the next directory we're going to look at

2:10is going to be the sbin directory, which is right here.

2:14So if we cd into sbin, this looks really quite familiar.

2:17It's very, very similar to the bin directory.

2:20We're going to see these binary executables,

2:22need default our system to operate.

2:23But these are going to be system level binary executables.

2:27And typically, these are going to require

2:29privilege escalation, i.e. administrator access to utilize

2:33these from the sbin directory.

2:35And then lastly, the one we want to look at

2:37is the user directory.

2:39Now, within the user directory, there's

2:41going to be a whole bunch of subdirectories.

2:44And these are subdirectories are going to contain executables,

2:47much like we saw before as well, as directories

2:50for different libraries and documentation.

2:52So here's the thing.

2:53Remember, we saw our /bin directory,

2:57and within there we had all of those bin executables.

3:00Within our user directory, we also

3:03have another bin directory.

3:05And this is the bin directory used for local user programs.

3:09If I go into this directory here user bin this time, do an ls,

3:14we're going to see the same type of output that we saw before.

3:16But this is going to be, like I say, for local user programs.

3:19So again, you expect to see the same type of output

3:22if I happen to scroll on up.

3:24We can see things like the ls commands the pwd command,

3:27so on and so forth.

3:28And in fact, when I happen to go on to a system,

3:31let's go into my home directory, and I do an ls.

3:34Ultimately, what is happening is that under the hood, what

3:37is being executed is this command simply in shorthand.

3:41So if I do this right here, we essentially

3:43get a listing of the directory once again.

3:45Now, the reason why I don't have to specify the full path

3:48is because this particular path is set within a path

3:51environment variable.

3:53And if I just say echo$ same path,

3:55what we're going to see here are a whole bunch of directories

3:58separated by colons.

4:00So you see the first directory here,

4:02then the next one, then the next, so on and so forth.

4:05Quite simply, when I issue an ls,

4:08Linux automatically is going to check

4:10these particular directories looking for an ls executable.

4:14And if it finds it, then it's going

4:16to call it directly from that.

4:17So quite simply, we can just shorthand it

4:20and because of that path environment variable,

4:22Linus configure where the executable actually resides.

4:25So we'll get to make use of these executables

4:27in great depth through this course.

4:29But for now, that is us for our introduction

4:31into these system binaries and programs.

4:33So I hope this has been informative for you,

4:35and I'd like to thank you for viewing.

What's next?

Ready to keep going?

For your team

Bring this training to your team

See how CBT Nuggets helps IT teams close skills gaps, hit compliance targets, and prove training ROI.

Request a Demo

Just need Administering Linux Servers? Enroll from $300/yr (19 skills)

Request a Demo