Day 6 file attributes and command execution process

1. The first column of the first character of the file type
rw-r - r-- permissions (next week)
4 This document is the number of links
The owner (user) root file
Has set root file (User Groups ==> family)
2018 File Size
The date Jul 29 21:50 files, and files created
boot file name

2.- file (normal file archive picture)
s socket a means of communication between the local process and the process (MySQL)
b file block device (hard disc partition)
Because Linux does not distinguish suffix, suffix usually used to represent, in order to facilitate the recognition of our own good
c character device for providing user input and output

##### l shortcut link files of similar windows

d directory similar to the windows folder
For some files can not accurately distinguish between type, you can use the file command to view
1. This can not accurately determine what type of file in the end
2. Use the file can accurately view the file types
[root@baozexu /]# file student.txt 
student.txt: ASCII text
Because Linux does not distinguish suffix, suffix usually used to represent, in order to facilitate the recognition of our own good.

3. Link file (with the windows shortcut similar)

Soft link: ln -s
     [root@baozexu tmp]# ln -s 123.txt  3_soft_link
Hard link: ln
     [root@baozexu tmp]# ln  456.txt  4_hard_link
Soft link usage scenarios (rarely make soft link file)
1. Software upgrade software rollback
[[email protected]~]# mkdir  qq_v1.1
[[email protected]~]# ln -s /root/qq_v1.1/ /root/qq #升级 
[[email protected]~]# mkdir qq_v1.2 
[[email protected]~]# rm -f /root/qq && ln -s /root/qq_v1.2/ /root/qq # 回退 rm -f qq && ln -s /root/qq_v1.1/ /root/qq
2. code upgrades-second fallback
3. inconvenient to move directory
2. hard link ln / root / file
The difference between a hard link and soft link 1) ln command to create a hard link, ln -s command to create a soft link.
Soft link usage scenarios (rarely make soft link file)
1. Software upgrade software rollback
[[email protected]~]# mkdir  qq_v1.1 
[[email protected]~]# ln -s /root/qq_v1.1/ /root/qq #升级 [[email protected]~]# mkdir qq_v1.2 
[[email protected]~]# rm -f /root/qq && ln -s /root/qq_v1.2/ /root/qq # 回退 rm -f qq && ln -s /root/qq_v1.1/ /root/qq

The difference between a hard link and soft link

(1) ln command to create a hard link, ln -s command to create a soft link.

(2) The directory can not create hard links, and hard links can not span partitions system.

(3) is particularly common directory soft link, and link support across soft partition systems.

(4) hard-linked files with the same inode source files, different soft link file with the source file inode.

(5) Delete soft link file, without any impact on the source files and hard linked files.

(6) To delete a file hard-linked files, without any impact on the source file and linked files.

(7) delete the link file source file, no effect on hard links, soft links will lead to failure.

(8) Delete files and hard links to the file, the entire file is really deleted.

 

6. 软链接与硬链接的本质区别?

1.软连接就是一个快捷方式,删除软连接不会影响源文件.

2.硬链接,类似于一个文件副本,删除硬链接不影响原文件,只有删 除所有的硬链接及其源文件,这个文件才算彻底被删除.

#### 命令执行流程

1.当我们执行一个命令, 整个命令执行流程如下:

#####(1) 判断命令是否通过绝对路径执行
#####(2) 判断命令是否存在alias别名
#####(3) 判断用户输入的是内置命令还是外置命令
#####(4) Bash内部命令直接执行,外部命令检测是否存在缓存
##### (5) 通过$PATH变量查找命令,有执行,无报错 command not found

绝对路径-->alias--->hash缓存-->$PATH变量路径--->有执行--->没有 command not found

Guess you like

Origin www.cnblogs.com/baozexu/p/11372801.html