Directory structure details of Linux

1, Catalog description

① there is only one root directory in Linux/

② the contents stored in each directory of Linux are planned, and do not misplace files

③ Linux manages our devices in the form of files, so in Linux system, everything is files

Requirement: it is necessary to have a general understanding of what contents are stored in various directories in Linux. After learning these directories, you need to have a general directory tree in your mind so that you can easily switch directories when using the system.

1 / (root) directory

Each file and directory starts from the root. The directories under / are:

[root@lixin /]# ls
bin data etc lib lost+found mnt opt root selinux sys usr
boot dev home lib64 media daxin proc sbin srv tmp var

2. / bin directory

The directory used to store binary executable commands. Common commands of users exist in this directory. For example: mkdir (create directory), cat (view file), find (find file), etc.

[root@lixin bin]# ls
alsaunmute egrep mkdir sh
arch env mknod sleep
awk ex mktemp sort
basename false more stty
bash fgrep mount su
cat find mountpoint sync
chgrp findmnt mv tar
......

3. / sbin directory

It is also used to store binary executable files, but the commands are only used by system administrator and management system (root user). For example: iptables, ifconfig, init, etc.

[root@lixin sbin]# ls
accton ip partx
addpart ip6tables pccardctl
agetty ip6tables-1.4.7 pidof
......
init nologin vgscan
initctl pam_console_apply vgsplit
insmod pam_tally2 vmcore-dmesg
insmod.static pam_timestamp_check weak-modules
install-info parted wipefs
installkernel partprobe

4. / dev directory

The directory where the device files are stored is similar to the device manager in windows. Because everything in linux is files, it's like mouse, keyboard and CD-ROM drive, which are files for linux. For example, / dev / CDROM (optical drive), / dev/sda1 (hard disk), etc.

[root@lixin dev]# ls
agpgart lp0 rfkill tty24 tty57
block lp1 root tty25 tty58
bsg lp2 rtc tty26 tty59
btrfs-control lp3 rtc0 tty27 tty6
bus MAKEDEV scd0 tty28 tty60
......
loop5 ram9 tty21 tty54 vga_arbiter
loop6 random tty22 tty55 zero
loop7 raw tty23 tty56

  5,/tmp

The place where temporary files are stored. Since the permission of this directory is 1777, all users have read-write executable permission to this directory, so others can also delete your files. (it can be used as the recycle bin of windows. Put the unused things here first.).

[root@lixin tmp]# ls
1.txt 2.txt 3.txt 4 5 6

  6,/home

The root directory where all user files are stored is the base point of the user's home directory. For example, the user's home directory is / home/user, which can be represented by ~ user

[root@lixin home]# ls -l
total 4
drwx------. 3 lixin lixin 4096 Mar 10 19:05 lixin

7. / boot directory

Store kernel files and system boot programs

[root@lixin boot]# ls
config-2.6.32-573.el6.x86_64
efi
grub
initramfs-2.6.32-573.el6.x86_64.img
lost+found
symvers-2.6.32-573.el6.x86_64.gz
System.map-2.6.32-573.el6.x86_64
vmlinuz-2.6.32-573.el6.x86_64

8. / lib directory

Store the shared libraries and kernel modules needed for running programs in the file system. The shared library is also called the dynamic link shared library. It functions like the. dll file in windows and stores the shared files needed by the root file system program.

[root@lixin lib]# ls
alsa libnsl.so.1
cpp libnss_compat-2.12.so
crda libnss_compat.so.2
firmware libnss_dns-2.12.so
i686 libnss_dns.so.2
...

9. / mnt directory

The system provides this directory for users to temporarily mount other file systems. We can mount external storage on / mnt /

[root@lixin /]# ls -ld /mnt
drwxr-xr-x. 2 root root 4096 Sep 23 2011 /mnt

10. / opt directory

The location of optional application packages for additional installation is not necessarily here, but it is not professional in other places (note that the packages are not installed yet)

[root@lixin /]# cd /opt
[root@lixin opt]# ls
rh

11. / media directory

A temporary directory for mounting mobile devices.

[root@lixin /]# ls -ld /mnt
drwxr-xr-x. 2 root root 4096 Sep 23 2011 /mnt

12. / root directory

Home directory of super administrator (system administrator).

[root@lixin ~]# ls -a
. .bash_logout install.log .tcshrc
.. .bash_profile install.log.syslog .viminfo
anaconda-ks.cfg .bashrc ipaddress
.bash_history .cshrc .lesshst

13. / proc directory (better not to move)

Virtual file system directory is the mapping of system memory. You can directly access this directory to get system information

14. / sys directory (better not to move)

As with / proc, it stores information files during system operation.

[root@lixin sys]# ls
block class devices fs kernel power
bus dev firmware hypervisor module

15. / srv directory (better not to move)

Abbreviation of service, mainly used to store the service or data provided by the local machine or server

16. / etc directory

Store system management and configuration files

The directory where the software configuration files installed from yum/rpm are located.

[root@lixin etc]# ls 
abrt mtab
acpi my.cnf
adjtime nanorc
......
mime.types xinetd.d
mke2fs.conf xml
modprobe.d yum
modulefiles yum.conf
motd yum.repos.d

17. / var directory

This directory is used to store files or directories that are constantly changed due to expanding things. It is often used to store files that need to change data during operation, and it is also the overflow area of some large files, such as log files of various services (system startup log, etc.) And so on.

18. / usr directory

It is used to store applications outside the system itself. It is an important directory / usr/local local system administrator software installation directory (install system level applications). For example, mysql file directory is in this directory after mysql is installed. This is the largest directory. Almost all the applications and files to be used are in this directory; generally speaking, the applications installed on linux system are installed in this directory by default. (note that the / usr directory is used to store the installed software; the / opt directory above is used to store the installation package)

/ usr/x11r6 directory for x window

/ usr/bin numerous applications

Some hypervisors for / usr/sbin super users

/ usr/doc linux documentation

/ usr/include header files required for developing and compiling applications under linux

/ usr/lib common DLL and package configuration files

/ usr/man help document

/ usr/src source code, the linux kernel source code is placed in / usr/src/linux

/ usr/local/bin locally added command

/ usr/local/lib locally added Library

[root@lixin etc]# cd /usr
[root@lixin usr]# ls
bin games lib libexec sbin src
etc include lib64 local share tmp

Keywords: Linux yum Windows MySQL

Added by auteejay on Sun, 05 Apr 2020 02:13:34 +0300