Home > Operation and Maintenance > Linux Operation and Maintenance > Detailed introduction to the file directory structure in Linux

Detailed introduction to the file directory structure in Linux

黄舟
Release: 2017-10-14 10:27:38
Original
2766 people have browsed it

This article mainly introduces the Linux file directory structure (little white version). The editor thinks it is quite good. Now I will share it with you and give it as a reference. Let’s follow the editor and take a look.

What I said before: It is only suitable for pure novices who have no back-end knowledge at all, because I am. It is a recommended learning method to first understand the directory structure of the Linux file system and then learn the Linux command line.

I have activated AWS for free for one year, so I can’t leave it idle, so I wanted to take this opportunity to try to learn some back-end knowledge. At that time, I was confused when I used winSCP to open the Linux system directory. When I used PuTTY to open the command line mode, it was in the home directory by default. After a lot of fussing, I finally successfully opened the server and bound the domain name, but it could only explain the AWS tutorial. 's powerful. Below I will briefly record what I learned and share it with novices like me.

Linux file directory quick overview


├── bin         //常用的命令
├── boot         //放置一些启动用的临时文件
├── cdrom        //
├── dev         //设备文件
├── etc         //系统所有配置文件都放在它下面
├── home         //用户目录,对应权限用户只能查看到自己的目录
│   ├── ec2-user       //aws登录名ec2-user权限的目录
├── lib         //用于存取程序的动态库和模块文件
├── lost+found      //用于存放系统异常时丢失的文件
├── media        //用于挂在本地磁盘或者其他储存设备
├── mnt         //用于挂在其他临时系统文件
├── opt         //
├── proc         //包含进程等信息,不是内存映射,不是真实目录
├── root         //root用户的目录
├── run         //
├── sbin         //里面很多是root用户才能执行的命令,系统的更新备份还原和开关机用的
├── selinux       //
├── srv         //service的缩写,是一些网路服务启动后,这些服务所需取用资料目录
├── sys         //系统信息
├── tmp         //存放各种临时文件
├── usr         //我们主要的操作空间
└── var         //变量文件--在运行中内容不断变化的文件。
Copy after login

Follow the official website tutorial to open the Apache running program

Tree directory diagram

Detailed directory explanation

/bin:There are many systems The directory where the executable file is placed, but /bin is special. Because /bin places commands that can be operated in single-player maintenance mode. The commands under /bin can be used by root and general accounts. They mainly include: cat, chmod (modify permissions), chown, date, mv, mkdir, cp, bash and other commonly used commands.

/boot: Mainly places files used for booting, including Linux core files, boot menu and configuration files required for booting, etc. The commonly used file name of Linux kernel is: vmlinuz. If you are using grub, the boot management program, the directory /boot/grub/ will also exist.

/dev: On Linux systems, any devices and peripherals exist in the form of files in this directory. Simply accessing a file in this directory is equivalent to accessing a device. The more important files include /dev/null, /dev/zero, /dev/tty, /dev/lp, /dev/hd, /dev/sd*, etc.

/etc: Almost all the main configuration files of the system are placed in this directory, such as personnel account and password files, startup files of various services, etc. Generally speaking, the attributes of each file in this directory can be viewed by ordinary users, but only root has the authority to modify them. FHS recommends not placing executable files (binary) in this directory. The more important files are: /etc/inittab, /etc/init.d/, /etc/modprobe.conf, /etc/X11/, /etc/fstab, /etc/sysconfig/, etc. In addition, the important directories under it are: /etc/init.d/: The default startup scripts of all services are placed here. For example, if you want to start or shut down iptables: /etc/init.d/iptables start, / etc/init.d/ iptables stop

/home: This is the system’s default user home directory. When you add a general user account, the default user home directory will be standardized here. More importantly, the home directory has two codenames:

~: represents the current user's home directory,
~guest: represents the home directory of the user named guest.

/lib: The system has many function libraries, and /lib places the function libraries that will be used when booting, as well as under /bin or /sbin The command will just call the function library. What is a function library? You can think of it as a plug-in. Certain instructions require these plug-ins to successfully execute the program. Especially important is the directory /lib/modules/, because this directory will contain core-related modules (drivers).

/media: media is the English word for media. As the name suggests, the removable device is placed under /media. Devices including floppy disks, compact discs, DVDs, etc. are temporarily mounted here. Common file names include: /media/floppy, /media/cdrom, etc.

/mnt: If you want to temporarily mount some additional devices, it is generally recommended that you place them in this directory. In ancient times, the purpose of this directory was the same as /media. Only after /media is created, this directory is used for temporary mounting.

/opt: This is the directory where third-party collaborative software is placed. What is third-party collaboration software? For example, the KDE desktop management system is an independent project, but it can be installed on a Linux system, so it is recommended that KDE software be placed in this directory. In addition, if you want to install additional software by yourself (not provided by the original distribution), you can also install your software here. However, in previous Linux systems, we were still used to placing it in the /usr/local directory.

/root: The home directory of the system administrator (root). The reason why it is placed here is because if you enter single-player maintenance mode and only mount the root directory, the directory can have root's home directory, so we would like root's home directory and the root directory to be placed in the same partition.

/sbin: Linux has a lot of commands used to set the system environment. Only root can use these commands to set the system, and other users can only use them to query. What is placed under /sbin is what is needed during the boot process, including the commands needed to boot, repair, and restore the system. As for some server software programs, they are generally placed in /usr/sbin/. As for the system binary generated by the software installed on the local machine, it is placed in /usr/local/sbin/. Common instructions include: fdisk, fsck, ifconfig, init, mkfs, etc.

/srv: srv can be regarded as the abbreviation of service. It is the data directory that these services need to access after some network services are started. Common services such as WWW, FTP, etc. For example, the web page data required by the WWW server can be placed in /srv/www/. Haha, it seems that the code we usually write should be placed here.

/tmp: This is a place where ordinary users or running programs can temporarily place files. This directory is accessible to anyone, so you need to clean it regularly. Of course, important information cannot be placed in this directory. Because FHS even recommends that all data under /tmp should be deleted when booting.

Contents of the usr directory

/usr/X11R6/: The directory where important data of the X Window System is placed, so named X11R6 means the last version of X is the 11th version, and it means the 6th release of this version.

/usr/bin/: Most of the commands available to users are placed here. Please note the difference between it and /bin. (Is it related to the boot process)

/usr/include/: C/c++ and other programming languages ​​​​are where the headers and include files are placed. When we use tarball When installing certain data using the *.tar.gz method (installing software using *.tar.gz), many of the included files will be used.

/usr/lib/: Contains the function library, object file (object file) of each application software, and executable files or scripts (scripts) that are not used by ordinary users. Some software will provide some special instructions to set up the server. These instructions are not often operated by the system administrator, so they will be placed in this directory. It should be noted that if you are using an If you install the software you downloaded by yourself (not the default provider of distribution), it is recommended to install it in this directory, which will make it easier to manage. For example, the software provided by your distribution is older, and you want to install newer software but do not want to remove the old version. At this time, you can install the new version of the software in the /usr/local/ directory, which can be used with the original old version of the software. There is a difference. You can go to /usr/local to have a look. This directory also contains subdirectories such as bin, etc, include, lib...

/usr/sbin/: Non-system operation. Required system commands. The most common one is the service command (daemon) of some network server software

/usr/share/: The place where shared files are placed. The data placed in this directory is almost indistinguishable. Data that can be read by any hardware architecture, because almost all are text files. Commonly found in this directory are these subdirectories: /usr/share/man: Online help files

/usr/share/doc: Miscellaneous software file descriptions

/usr/share/zoneinfo:Time zone files related to time zones

/usr/src/:General source code is recommended to be placed here, src has source the meaning of. As for the core source code, it is recommended to place it in the /usr/src/linux/ directory.

The above is the detailed content of Detailed introduction to the file directory structure in Linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template