[Linux Fundamentals Part 3] Why do you say that in the Linux world, everything is a file

[Linux Fundamentals Part 3] Why do you say that in the Linux world, everything is a file?

[Linux Fundamentals Part 3] Why do you say that in the Linux world, everything is a file?

I.Linux Fundamentals. Introduction

, friends, the last column explained the installation of VMtools and the setting of shared folders

realizes the meaning of everything in the Linux world ! Following Mr. Han Shunping to learn Linux, the blogger is slowly updating the learning of the Linux column. If you feel that the blogger's writing is not bad, you can pay attention to the column and learn together~~

2. Linux Fundamentals.Basic introduction

The Linux file system adopts a hierarchical tree-like directory structure. In this structure, the top level is the root directory "/", and then other directories are created under this directory.
When learning Linux, it is very important to have a deep understanding of Linux's tree file directory

3. Linux Fundamentals.Structure display

Open the computer in Linux, you can find the following structure, I will give a general overview here

Among them, the first layer of everyone is the root directory, the second layer I did not fully list, this is my second layer

The third layer is determined according to the previous layer. Of course, there will be a fourth layer, a fifth layer, etc.

Fourth, the actual analysis
Then some friends have to ask, hey, blogger, what do you mean when you say that in the Linux world, everything is a file? I still don't get it! Don't worry, let's take it slow

Scenario 1
Everyone must still remember that when learning Linux, there is a user login function, and Linux can only be used by entering the correct user name and password. So, where are the users we created?

Taking my own user as an example, in addition to the root user, I also created a tom user, so where is this tom user? Hey, look carefully, it is in the home directory on the second layer, as shown in the figure:

Scenario 2
When we learn Linux, we will inevitably use Vim to edit. If I use Vim to write a Java program, where is the Java program? Hey, don't panic, let's look for it slowly, we can find that it is hidden behind the root folder, as shown in the figure:

Scenario three
Learning to learn, the more we learn, the more we learn to use middleware such as Redis, zookeeper, etc., and we still vaguely remember that they are decompressed in a certain folder, let us search carefully, we can find that they are located in the opt directory, As shown in the figure:

At this point, I think you guys should know that the things we use are in a certain folder. Of course, which folder these things are placed in is not fixed. However, since it is to work, there are certain rules that we should follow to decide what type of file goes in what directory!

5. Specific structure
/bin: This directory stores the most frequently used commands
/ sbin : This is the system management program used by the system administrator
/home: The home directory for ordinary users. In Linux, each user has its own directory. Generally, the directory is named after the user's account.
/root: This directory is the user home directory of the system administrator
/lib: The most basic dynamic link shared library required for system boot, almost all applications need to use these shared libraries
/ etc : All configuration files and subdirectories required for system management, such as my.conf for installing the mysql database
/ usr : This is a very important directory where many of the user's applications and files are placed
/boot: stores some core files used when starting Linux, including some connection files and image files
/ tmp : store some temporary files
/media: The Linux system will automatically recognize some devices, such as U disks. When recognized, Linux will mount the recognized devices to this directory.
/opt: This is the directory where additional software is installed for the host
/var: This directory stores things that are constantly expanding. It is customary to put frequently modified directories in this directory, including various log files.
There are many more. If you are interested, you can check them online. You don’t need to memorize them, just understand them.

6. Linux Fundamentals.Summary

We must deeply understand the file directory of the Linux system, and realize that in the Linux world, everything is a file. In the future study, pay attention to where the files are placed, accumulate slowly, and work hard together! ! !

Related Articles

Explore More Special Offers

  1. Short Message Service(SMS) & Mail Service

    50,000 email package starts as low as USD 1.99, 120 short messages start at only USD 1.00