System folders are organized in a standard way on most Linux systems. Learn about the Filesystem Hierarchy Standard in this video.
- [Instructor] CentOS, along with many Unix-like systems, follows the standard called the Filesystem Hierarchy Standard, or FHS, which defines locations, permissions, and file names for system and other files. This standard makes it possible for users and programs to find what they're looking for, in consistent places. More information about the standard is available on the Linux Foundation website. For our purposes here, let's take a look at a few of the commonly used directories in the file system. I've generated this output with a command called tree, which can be installed from the repository. Don't worry about it for now, I just want you to pay attention to the structure of the directories. The most important directory, and the one on which everything else is based, is the root directory, represented with a slash. It's the highest level on the hierarchy, meaning that everything else is contained within it, or is under it. We'll see the slash representing root in absolute file paths but it also serves as a divider for directory paths. Under the root directory, there are a number of other directories with special purposes for the system. Alphabetically, the first one is /bin, which contains the command binaries, or compiled programs, that make the command-line environment usable. The files in this folder include change directory, copy, the bash shell itself, grep, awk, and a lot more. You can see from the listing here with the arrow, /bin is actually a symlink, or symbolic link, to the /usr/bin directory. A symbolic link is a pointer to somewhere else in the file system. The files we'd expect to find in /bin, are really in /usr/bin. In this case, to maintain compliance with the Filesystem Hierarchy Standard, the file system will behave as though /bin is a real directory. After that, there's /boot, which is where the software that allows the system to start up lives. Among other things, it contains the boot loader called grub and the Linux kernel itself. Unless you're doing some pretty specific and advanced things, you won't spend any time in here when you're learning about CentOS in general. /dev is where the system devices are. It contains references to hardware and software resources on the system, and you won't spend much time in here either until you start getting into working with devices. But you'll see /dev as part of paths that you'll use for various tasks. For example, you might see scripts that send output to /dev/null, which is a software device that sends data nowhere. Data written there isn't saved and it just goes away. /dev/random and /dev/urandom are random number generators that can be used for various purposes. If you're working with disks, you'll see things like /dev/sda and /dev/sda1. This represents serial disk A, the first hard drive, and serial disk A slice one, the first slice, or partition, or serial disk A. The /etc directory holds system configuration files and if you make changes to the system, you'll probably do so in here. On CentOS, a lot of the configuration files that you'll work with are inside /etc/sysconfig. The /home directory is where user home directories live. Home folders, or home directories, keep each user's files separate, and this folder acts as the default landing spot, or working directory, when a non-root user connects via SSH or FTP. /lib is where binary files for system binaries live. You probably won't spend much time in here. The /media directory serves as a mount-point for removable media, and the /mnt directory is where the system mounts temporary file systems. /opt provides a space for software packages to set up their own folder structure. If you work with third-party packages and tools, you might find yourself working in here. The /proc directory contains some system information. /root is the home folder for the root user, and /run contains information about running processes on the system. /sbin is where system binaries live, and /srv holds information and files for various services. /sys shows information from the /proc directory in a different format, and the /tmp directory contains temporary files. This folder can be cleared out when the system restarts, so you don't want to ever store anything important there. The /usr directory provides another place for applications to live, and finally, the /var directory contains variable files that change over time, such as system logs, which can be found in /var/log. It can be intimidating to see all of these directories if you are new to Linux, but for the most part, you'll only spend time inside a few of these as you're learning. If you're coming to CentOS from another distro, this should look familiar to you. Seasoned administrators may have all of the functions of each directory memorized, but you can always take a look at the specification to remind yourself, too.
- What is CentOS?
- Installing CentOS
- Configuring networking manually
- Configuring the network with NetworkManager
- Connecting remotely
- Working with security-enhanced Linux (SELinux)
- Setting up a firewall
- Setting up a web server
- Sharing user home folders with Samba
- Setting up a desktop environment