1 00:00:06,690 --> 00:00:09,750 So to start with, why are files so important on Linux? 2 00:00:10,650 --> 00:00:14,434 Well, it's easy to understand. On Linux everything is a 3 00:00:14,434 --> 00:00:18,219 file configuration is stored in mostly ASCII text configuration files. 4 00:00:18,899 --> 00:00:24,510 Devices are addressed by using device files, programs are started through files, and so much more. 5 00:00:25,829 --> 00:00:31,410 Files are organized in directories, also known as folders, where each directory has its own purp. 6 00:00:32,710 --> 00:00:36,530 And to start with, it's a good idea to know which directories exist on Linux. 7 00:00:37,969 --> 00:00:44,320 Now, if a directory needs to be separated from other files, a specific storage device can be mounted on it. 8 00:00:44,979 --> 00:00:48,954 That's also what you want to do. If you connect a USB thumb drive, 9 00:00:48,954 --> 00:00:52,929 for instance, you mount it on a specific directory in the file system hierarchy. 10 00:00:54,509 --> 00:00:59,706 Directories on Linux are highly standardized and that means that on all 11 00:00:59,706 --> 00:01:04,903 Linux distributions you will find USR for program files or VAR for 12 00:01:04,903 --> 00:01:10,099 files dynamically created by the operating system or etc for configuration files. 13 00:01:11,120 --> 00:01:16,370 Now this standardization is coming from the File System Hierarchy 14 00:01:16,370 --> 00:01:21,620 Standard or fhs that happens to be a Linux Foundation 15 00:01:21,620 --> 00:01:26,870 Standard Linux foundation is a standardization organization behind Linux and 16 00:01:26,870 --> 00:01:32,120 they provide recommendations and most distributions are adopting these recommendations. 17 00:01:34,090 --> 00:01:38,730 If you are a regular user. As a regular user you have write access to two directories only. 18 00:01:39,409 --> 00:01:44,519 And these are the home directory in home and the TMP directory. 19 00:01:45,280 --> 00:01:50,344 If ever you are wondering if you have write access, an easy way to find out is 20 00:01:50,344 --> 00:01:55,409 by using touch followed by a file name that will verify write access to a specific location. 21 00:01:55,969 --> 00:01:58,810 Let me show you what this default file system hierarchy looks like. 22 00:02:00,019 --> 00:02:04,939 So to start with, I'm using CD slash to go to the root directory 23 00:02:04,939 --> 00:02:09,860 and there I'm typing tree. And tree is showing the default directories that exist. 24 00:02:11,080 --> 00:02:16,629 Now, they are highly standardized and that means that most Linux distributions will look more or less the same. 25 00:02:17,210 --> 00:02:23,240 But sometimes, up to the discretion of a distribution, they might add the directories that you don't find anywhere else. 26 00:02:24,340 --> 00:02:29,634 Now let's have a look at these directories using LS link because we can see 27 00:02:29,634 --> 00:02:34,930 a couple of them are pointing to something else. These are the so called symlinks. 28 00:02:35,490 --> 00:02:41,979 These are symbolic links and they make sure that directory can be accessed in two different ways. 29 00:02:43,139 --> 00:02:45,860 First thing I want to show you is the boot directory. 30 00:02:46,650 --> 00:02:50,485 In the boot directory you find everything that your Linux system needs to 31 00:02:50,485 --> 00:02:54,319 boot, including the Linux kernel, which is the name VM Linus 6.12. 32 00:02:58,259 --> 00:03:03,646 Now these directories have specific colors and the colors in fact don't mean too much. They 33 00:03:03,646 --> 00:03:09,033 depend on the rest of your terminal settings. So I would say don't focus on colors 34 00:03:09,033 --> 00:03:14,419 too much. Focus on output of vals as displayed using the LS L command. 35 00:03:16,780 --> 00:03:19,770 We don't do that. Now I would like to show you the dev directory. 36 00:03:20,330 --> 00:03:24,074 The dev directory is for device files and these device valves 37 00:03:24,074 --> 00:03:27,819 are files that allow you to communicate with your hardware. 38 00:03:28,840 --> 00:03:32,745 My hard disk for instance is NVME 0n1 and like that there 39 00:03:32,745 --> 00:03:36,650 are more device valves that you are going to work with. 40 00:03:37,289 --> 00:03:42,639 We'll discover some of these valves as we move on in the later lessons in this course. 41 00:03:44,000 --> 00:03:48,389 Next we have the Etc directory. Etc directory is for configuration files. 42 00:03:49,009 --> 00:03:54,599 Just pick out any of these configuration files. Like hey, OS release. I like OS release. 43 00:03:55,219 --> 00:03:59,939 The OS release file is in fact a standard file on Linux 44 00:03:59,939 --> 00:04:04,659 that is printing information about your current distribution. As you can see. 45 00:04:05,939 --> 00:04:10,439 What else do we have? We have the home directory. In the home directory, 46 00:04:10,439 --> 00:04:14,939 users have their own environment and that's what they are allowed to write. 47 00:04:15,680 --> 00:04:21,029 Skipping a few and then we get to the proc directory. The proc directory is a very interesting directory. 48 00:04:21,589 --> 00:04:26,550 It's a direct view on what is going on in the Linux kernel. 49 00:04:27,370 --> 00:04:30,930 There are some valves giving information about the current state of your system. 50 00:04:32,170 --> 00:04:36,050 Like for instance the CPU info file which is 51 00:04:36,050 --> 00:04:39,930 giving me information about my current CPU configuration. 52 00:04:42,509 --> 00:04:48,595 The next directory that we need to talk about is the USR directory because the USR 53 00:04:48,595 --> 00:04:54,680 directory is about program files and the content of the USR directory is highly standardized. 54 00:04:55,560 --> 00:04:58,350 In USR you find bin and you'll find sbin. 55 00:04:58,910 --> 00:05:02,915 Bin is for non root binaries which are program files 56 00:05:02,915 --> 00:05:06,920 and sbin is for program files that require root access. 57 00:05:08,100 --> 00:05:11,000 Another important subdirectory here is local. 58 00:05:12,040 --> 00:05:18,639 In user local you'll also find bin and sbin. Now what is the difference? Well, the difference 59 00:05:18,639 --> 00:05:25,239 according to the FHS is that files that are installed from operating system packages should be in 60 00:05:25,240 --> 00:05:31,839 USR bin and in usersbin and files that you've created yourself should be in user local bin. 61 00:05:33,779 --> 00:05:39,459 We'll work out some examples about that later. Last directory I want to talk about is the var directory. 62 00:05:40,000 --> 00:05:44,835 The var directory contains a lot of stuff that is dynamically created by the 63 00:05:44,835 --> 00:05:49,670 operating system, like var log, for instance, in which you will find log files. 64 00:05:50,329 --> 00:05:55,879 You want to know which one is important. Well, use LS L that will show you the size of 65 00:05:55,879 --> 00:06:01,430 your files. And there you can see that definitely the messages file is the biggest of all of them. 66 00:06:02,100 --> 00:06:07,200 And that is because this var log messages on CentOS system is the main system 67 00:06:07,200 --> 00:06:12,300 log file apart from systemd journal D. But you will learn more about that later.