[Linux] file and path

1. Linux related software

xftp: used to transfer files
xshell : used to type commands

Second, the file structure of Linux

windowsThere are drive letters under the system: such as C drive, D drive, etc. LinuxThere is no concept of drive letters, there is only one root directory /, and all files are under it.

insert image description here
Enter the command in the root directory lsto view the files in the root directory:
insert image description here

The color of the files in the root directory is different because the file types are different.
For example: the dark blue ones are ordinary directories , the light blue ones are some executable files or system libraries , and the tmp one with a green background is a temporary directory.

Different colors are determined by Xsell, you can set the color scheme yourself according to the following figure:

insert image description here

3. System files in the root directory

Table of contents illustrate Remark
bin Store executable instructions for ordinary users Ability to perform processing even in single-user mode
boot boot directory Including the Linux kernel file and the files required for booting
dev Equipment catalog All hardware devices and peripherals are placed in this device directory
etc Various configuration file directories Most configuration properties are stored here
lib/lib64 Commonly used dynamic link libraries at boot time The bin and sbin instructions will also call the corresponding lib library
media Removable device mount directory Temporary hanging directory like floppy disk, U disk, CD, etc.
mnt User temporarily mounts other file systems Additional devices can be mounted here, relatively temporarily
opt Third-party software installation directory Now habitually placed in /usr/local
proc virtual file system Usually it is a mapping in memory. Pay special attention to deleting data files by mistake, such as DB, as long as the system does not restart, there is still a high probability that the data can be retrieved
root sysadmin home directory Except root, other users are placed in the /home directory
run System operation is the required file It was previously prevented from being in /var/run, and later split into a separate /run directory. Regenerate the corresponding directory data after restarting
sbin Administrative commands that only root can run Similar to bin, but only belongs to the root administrator
srv The data directory that needs to be accessed after the service starts
sys Virtual file system like proc Record core system hardware information
tmp Store temporary files directory All users can read and write this directory
usr application placement directory
was Store files that are frequently changed during system execution

In the Linux system, several directories are more important, and you need to be careful not to accidentally delete or change internal files at will.

​:/etc As mentioned above, this is the configuration file in the system. If you change a file in this directory, the system may not start.

​:/bin, /sbin, /usr/bin, /usr/sbin This is the directory where the system presets the execution files. For example, ls is in the /bin/ls directory.

​ It is worth mentioning that /bin, /usr/bin are commands for system users (common users except root), while /sbin, /usr/sbin are commands for root.

​:/var This is a very important directory. There are many programs running on the system, so each program will have a corresponding log, and these logs will be recorded in this directory, specifically in the /var/log directory. In addition, the mail The default placement of is also here.

4. Basic concepts

1. User type

  • Ordinary users: under the roothome
  • root user
# 在home有一个user  这里就是之前创建的用户
[root@localhost ~]# cd /home
[root@localhost home]# ls
buting

# 使用~回到root目录,使用/是回到根目录下
[root@localhost buting]# cd ~
[root@localhost ~]# 

pwd: Indicates to display the current directory

# 切换到另外一个用户
[root@localhost buting]# su buting
[buting@localhost ~]# pwd
/home/buting

2. The command prompts of the root user and ordinary users are different.
The prompt of the ordinary user is $
the prompt of the root user.#

3. cd ~It means to go to the home directory

4. Absolute path and relative path
Absolute path
The path described starting from the / directory is an absolute path, such as:

[root@localhost /]# cd /home/buting
[root@localhost /]# ls /usr

Relative path
The path described from the current location is a relative path, such as:

[root@localhost /]# cd ../../
[root@localhost /]# ls abc/def

5, . and…

. Indicates that the current directory
.. indicates the upper level directory, that is, the parent directory

Guess you like

Origin blog.csdn.net/hold_on_qlc/article/details/130441398