Linux发行版
slackware:SUSE Linux Enterprise Server(SLES),OpenSuse桌面
debian:ubuntu,deepin(深度),mint
redhat:RHEL:RedHat Enterprise Linux,每18个月发行一个新版本
? CentOS:Community Enterprise Operating System兼容RHEL的格式
? 中标麒麟:中标软件
? Fedora:每6个月发行一个新版本
Alpine:一个面向安全的轻型Linux发行版,它不同于通常Linux发行版,Alpine采用了musllibc和busybox以减小系统的体积和运行时资源消耗,但功能上比busybox又完善的多,只有5M左右大小
ArchLinux:轻量简洁,遵循K.I.S.S原则( keep it simple and stupid ),Manjaro
Gentoo:极致性能,不提供传统意义的安装程序,下载源代码在本机上编译安装软件
LFS:Linux From scratch 自制Linux,只是一个说明书
。这些元数据是存放在inode(index node)表中。mode表中有很多条记录组成,第一条记录对应的存放了一个文件的元数据信息
第一个mode表记录对应的保存了一下信息:
stat命令查看文件的元数据
[root@localhost ~]# stat anaconda-ks.cfg
File: ‘anaconda-ks.cfg’
Size: 1474 Blocks: 8 IO Block: 4096 regular file
Device: 802h/2050d Inode: 201326659 Links: 1
Access: (0600/-rw-------) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u:object_r:admin_home_t:s0
Access: 2021-04-20 22:38:49.088059942 +0800
Modify: 2021-04-20 22:38:49.090059942 +0800
Change: 2021-04-20 22:38:49.090059942 +0800
Birth: -
[root@localhost ~]# stat /etc
File: ‘/etc’
Size: 8192 Blocks: 24 IO Block: 4096 directory
Device: 802h/2050d Inode: 134320193 Links: 74
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u:object_r:etc_t:s0
Access: 2021-04-20 22:58:28.178009473 +0800
Modify: 2021-04-20 22:57:00.940005313 +0800
Change: 2021-04-20 22:57:00.940005313 +0800
Birth: -
[root@localhost ~]# df -i /boot
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda1 524288 327 523961 1% /boot
touch命令可以用来创建空文件或刷新文件的时间
[root@localhost ~]# ls -l /etc/issue
-rw-r--r--. 1 root root 23 Nov 23 2018 /etc/issue
[root@localhost ~]# touch /etc/issue
[root@localhost ~]# ll /etc/issue
-rw-r--r--. 1 root root 23 Apr 21 03:05 /etc/issue
硬链接
硬链接本质上就给一个文件起一个新的名称,实质是同一个文件
特性:
格式:
ln filename [linkname]
符号(或软)连接
一个符号连接指向另一个文件,就像windows中快捷方式,软连接文件和原文件本质上不是同一个文件
软连接特点
格式:
ln -s filename [linkname]
[root@localhost data]# touch dir
[root@localhost data]# ll
total 0
-rw-r--r--. 1 root root 0 Apr 21 03:36 dir
[root@localhost data]# echo hello world > dir
[root@localhost data]# cat dir
hello world
[root@localhost data]# ln -s /data/dir /data/dirlink-sofr
[root@localhost data]# ln /data/dir /data/dirlink-hard
[root@localhost data]# ll
total 4
-rw-r--r--. 1 root root 12 Apr 21 03:41 dirlink-hard
lrwxrwxrwx. 1 root root 3 Apr 21 03:41 dirlink-soft -> dir
[root@localhost data]# cat dirlink-soft
cat: dirlink-soft: No such file or directory
[root@localhost data]# cat dirlink-hard
hello world
硬链接和软连接区别总结
1、本质
? 硬链接:本质是同一个文件
? 软连接:本质不是同一个文件
2、跨设备
? 硬链接:不支持
? 软连接:支持
3、inode
? 硬链接:相同
? 软连接:不同
4、连接数
? 硬链接:创建新的硬链接,链接数会增加,删除硬链接,连接数会减少
? 软连接:创建或删除,连接数不会变化
5、文件夹
? 硬链接:不支持
? 软连接:支持
6、相对路径
? 硬链接:原始文件相对路径是相对于当前工作目录
? 软连接:原始文件的相对路径是相对于链接文件的相对路径
7、删除源文件
? 硬链接:只是链接数减一,但链接文件的访问不受影响
? 软连接:链接文件将无法访问
8、文件类型
? 硬链接:和源文件相同
? 软连接:链接文件和源文件无关
9、文件大小
? 硬链接:和源文件相同
? 软连接:源文件的路径的长度
原文:https://blog.51cto.com/nanhb/2720262