硬链接
ls -i 查看文件inode 值 (同样适用于df命令)
    -d 只看文件夹属性
   -h 按单位显示容量 (df命令中显示容量)
文件系统硬链接、软链接
ln命令可以创建硬链接
ln 源文件 目标文件 br/>例:
[root@localhost ~]# touch a.txt
[root@localhost ~]# ll a.txt
-rw-r--r--. 1 root root 0 12月  4 18:51 a.txt #链接数是1
[root@localhost ~]# ln a.txt a2.txt #创建硬链接br/>[root@localhost ~]# ll a.txt
-rw-r--r--. 2 root root 0 12月  4 18:51 a.txt #链接数变成2br/>[root@localhost ~]# ll a2.txt
-rw-r--r--. 2 root root 0 12月  4 18:51 a2.txt #链接数同样为2br/>[root@localhost ~]# vim a.txt
[root@localhost ~]# cat a.txtbr/>test inode or data
[root@localhost ~]# cat a2.txt
test inode or databr/>[root@localhost ~]# ls -i a.txt a2.txt
140007310 a2.txt  140007310 a.txt #inode值一样br/>测试
[root@localhost ~]# rm -rf a.txt
[root@localhost ~]# cat a2.txt
test inode or data

[root@localhost ~]# ll a2.txt
-rw-r--r--. 1 root root 20 12月  4 18:57 a2.txt
[root@localhost ~]#

总结:硬链接的特点,不能跨分区,不能给文件夹创建。(也不知道有啥用)

软链接
:相当于windows中的快捷方式 
               创建软链接不会增加链接数
ln -s  源文件  链接名br/>例:
[root@localhost ~]# ln -s a2.txt as.txt
[root@localhost ~]# lsbr/>a2.txt  as.txt
[root@localhost ~]# ll as.txt
lrwxrwxrwx. 1 root root 6 12月  4 19:08 as.txt -< a2.txt
例:
跨分区,跨文件夹
[root@localhost ~]# ln -s /boot/grub2/   grub2br/>[root@localhost ~]# ll
总用量 4br/>-rw-r--r--. 1 root root 21 12月  4 19:08 a2.txt
lrwxrwxrwx. 1 root root  6 12月  4 19:08 as.txt -< a2.txt
lrwxrwxrwx. 1 root root 12 12月  4 19:11 grub2 -< /boot/grub2/
[root@localhost ~]# ll -d grub2/
drwx------. 6 root root 104 11月 29 18:04 grub2/br/>例:
 创建软链接不会增加链接数
[root@localhost ~]# ll a2.txt
-rw-r--r--. 1 root root 21 12月  4 19:08 a2.txtbr/>[root@localhost ~]# ln -s a2.txt assas.txt
[root@localhost ~]# ll a2.txtbr/>-rw-r--r--. 1 root root 21 12月  4 19:08 a2.txt
实例:
服务器中小文件很多,导致硬盘有空间,但无法创建文件
inode数被用光
[root@localhost /]# df -i
文件系统          Inode 已用(I)  可用(I) 已用(I)% 挂载点
/dev/sda3      58510336  145977 58364359       1% /
devtmpfs         480727     387   480340       1% /dev
tmpfs            484369       6   484363       1% /dev/shm
tmpfs            484369     518   483851       1% /run
tmpfs            484369      13   484356       1% /sys/fs/cgroup
/dev/sda1        204800     328   204472       1% /boot
tmpfs            484369      17   484352       1% /run/user/42
tmpfs            484369       1   484368       1% /run/user/0