文件属性
[root@Eva.L~]# ll -h
total 65M
-rw-r--r--. 1 root root 672 Jul 30 16:27 1.txt
-rw-r--r--. 1 root root 56M Jul 30 15:29 access.log
-rw-------. 1 root root 1.6K Jul 24 23:37 anaconda-ks.cfg
-rw-r--r--. 1 root root 286 Jul 30 11:46 awkvars.out
-rw-r--r--. 1 root root 0 Jul 29 10:04 file
-rw-r--r--. 1 root root 0 Jul 29 10:34 file1
-rw-r--r--. 1 root root 16 Jul 30 11:31 file1.txt
-rw-r--r--. 1 root root 24 Jul 30 11:36 file2.txt
-rw-r--r--. 1 root root 25 Jul 30 11:10 file.txt
-rw-r--r--. 1 root root 2.5M Jul 30 12:22 fj.xuliangwei.com.log
-rw-r--r--. 1 root root 6.8M Jul 16 18:49 hexin.exe
-rw-r--r--. 1 root root 744 Apr 2 14:57 ip.txt
-rw-r--r--. 1 root root 986 Jul 29 11:59 pass
-rw-r--r--. 1 root root 986 Jul 30 20:54 passwd
-rw-r--r--. 1 root root 12K Feb 14 17:31 tt.jpeg
-rw-r--r--. 1 root root 424 Jul 30 12:29 web.log
-rw-r--r--. 1 root root 5.2K Jul 29 12:40 文件管理操作.md
第一行的第一个字符 表示文件的类型
rw-r--r-- 表示权限
1 表示被连接的次数
root 文件的拥有者
root 文件的拥有组
672 文件的大小
Jul 30 16:27 文件的日期及创建文件的时间
1.txt 文件的名字

文件类型
[root@Eva.L~]# ll -d /etc/hosts /tmp /bin/ls /dev/sda /dev/tty1 /etc/grub2.cfg /dev/log
-rwxr-xr-x. 1 root root 117680 Oct 31 2018 /bin/ls
srw-rw-rw-. 1 root root 0 Jul 30 18:55 /dev/log
brw-rw----. 1 root disk 8, 0 Jul 30 18:55 /dev/sda
crw--w----. 1 root tty 4, 1 Jul 30 18:55 /dev/tty1
lrwxrwxrwx. 1 root root 22 Jul 24 23:33 /etc/grub2.cfg -> ../boot/grub2/grub.cfg
-rw-r--r--. 1 root root 158 Jun 7 2013 /etc/hosts
drwxrwxrwt. 14 root root 4096 Jul 31 14:45 /tmp
- 文件(普通文件、图片、压缩包)
s socket本地进程与进程间的通信(以后将mysql会讲)
b 块设备文件 (硬盘,光驱,分区)
c 字符设备 用于提供用户的输入和输出
l 连接文件 类似于window的快捷方式
d 目录 类似window的文件夹
1.对于一些文件无法精准取分什么类型,可以用file命令查看
[root@Eva.L~]# ll /bin/ls 1.sh 1.txt access.log img.jpg 123.zip
-rw-r--r--. 1 root root 672 Jul 30 16:27 1.txt
-rw-r--r--. 1 root root 58112885 Jul 30 15:29 access.log
-rwxr-xr-x. 1 root root 117680 Oct 31 2018 /bin/ls
2.使用file能精确查看出文件是什么类型
[root@Eva.L~]# file /bin/ls 1.sh 1.txt access.log img.jpg 123.zip
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=ceaf496f3aec08afced234f4f36330d3d13a657b, stripped
1.sh: cannot open (No such file or directory)
1.txt: ASCII text
access.log: ASCII text, with very long lines
img.jpg: cannot open (No such file or directory)
123.zip: cannot open (No such file or directory)
PS:因为Linux不区分后缀,后缀通常都是用来方便用户识别的
链接文件
1.软链接(类似window的快捷方式)
1.软件升级
[root@Eva.L~]# mkdir qq_v.1.1 #假设我们有一个软件qq_v1.1
[root@Eva.L~]# ln -s /root/qq_v.1.1/ /root/qq # 这个时候我们建立一个软链qq接到qq_v.1.1
[root@Eva.L~]# mkdir qq_v.1.2 #这个时候我们推出了 qq_v.1.2
[root@Eva.L~]# rm -f /root/qq && ln -s /root/qq_V1.2 /root/qq #我们将旧的链接删除,qq链接新的版本qq_v.1.2
突然 我们发现新版本的qq存在重大漏洞
[root@Eva.L~]# rm --f qq && ln -s /root/qq_v1.1 /root/qq #这个时候我们删除新的软链接,建立新的软链接到我们老版本的qq
2.代码升级,秒级退回
这次我们用图来解释

服务器上的程序是会升级,但是上线之后难免会出现某些意外,这个时候们用软链接,当出现不得返回旧版本的时候,则用软链接切回旧版本
3.不方便移动的目录
有些文件目录不方便移动,我们用软链接来进行访问,方便快捷
硬链接与软链接区别
1.ln命令创建硬链接,ln -s命令创建软链接。
2.目录不能创建硬链接,并且硬链接不可以跨越分区系统。
3.目录软链接特别常用,并且软链接支持跨越分区系统。
4.硬链接文件与源文件的inode相同,软链接文件与源文件inode不 同。
5.删除软链接文件,对源文件及硬链接文件无任何影响。
6.删除文件的硬链接文件,对源文件及链接文件无任何影响。
7.删除链接文件的源文件,对硬链接无影响,会导致软链接失效。
8.删除源文件及其硬链接文件,整个文件会被真正的删除。
命令执行流程
当我们执行一个命令, 整个命令执行流程如下:
1.判断命令是否通过绝对路径执行
2.判断命令是否存在alias别名
3.判断用户输入的是内置命令还是外置命令
4.Bash内部命令直接执行,外部命令检测是否存在缓存
5.通过$PATH变量查找命令,有执行,无报错 command not found
绝对路径-->alias--->hash缓存-->$PATH变量路径--->有执行--->没有 command not found