From the course: Practical Linux for Network Engineers: Part 1

File systems

(upbeat music) - [Instructor] Linux has a file system in a similar way to Windows and macOS. File systems are very important in Linux, and it's good that you learn a bit about the Linux directory structure. You'll find a similar directory structure on all Linux distributions. In Windows, as an example, you'll have the C drive, perhaps a D drive, or an E drive, and various other drives connected to a Windows system. So typically, in Windows, you will always have C colon, which is, by default, the disk where the Windows Operating System is installed. So in the same way as in Windows where you have a file system, that could be using FAT32 or NTFS, you have something similar in Linux. MacOS has something similar. So as an example, we have a root directory, and underneath that we have Users, such as david. And under david we have a Desktop directory where files are stored. Or, as an example, my Downloads directory has various files which I've downloaded. Linux does something very similar, where we have as an example, a root directory, and various directories that branch out from the root directory. If I type cd, notice I'm in my home directory. I know that because of the tilde here. Print working directory shows me that I'm in the root home directory, and that's because I'm logged in as root. On this Ubuntu server, pwd shows me that I'm in home/david, notice the tilde. But if I type cd, notice I'm in root, or cd etc, notice I'm in root etc. On this docker container, cd root, notice I'm in the root directory. Cd etc, or etc, this is where I am currently. cd network. Notice that's where I am. pwd will also show me that. ls shows me the files in this directory. cat interfaces, once again, shows me the contents of the interfaces file. cd takes me back to my home directory. pwd shows me where I am. Notice this is the home directory of the user root in the root directory. The root directory, or forward slash directory, is the starting point of all directories or files on the Linux system. On a Windows PC, as an example, notice I'm in C: \Users\david. If I type cd, that's where I am. But cd, in Windows backslash, takes me to the root of C. So dir shows me directories in C. If I type cd Users, that takes me to the Users directory, cd david takes me to the david directory. cd backslash, not forward slash in Windows, even though that works here, takes me to the root of drive C so it's not exactly the same, but as an analogy, this is the root of the Linux file system. And notice all directories, such as etc, branch out of the root directory. ls or list shows us files in this directory. Notice the files are shown with different colors. If you have problems reading the colors, use \ls to display the files in black. So ls shows us files and directories in this directory. In other words, a list, files or directories. Shows them with colors. Backslash ls shows us files and directories as black. So if you have a problem reading the various colors, just use \ls.

Contents