
本文共 5924 字,大约阅读时间需要 19 分钟。
���Linux ������������������������������������������������������������������������������������������������������ln
������������������
���������������������������, ������������ windows���������������������������������������������������������������������������������������������������������
���������������
������ ln -s ��������� ���������
������������������������������������������������������������������������������������������������������������
- ������������������������
[root@ecs-centos-7 tt]# stat a.txt | grep LinksDevice: fd01h/64769d Inode: 131096 Links: 1[root@ecs-centos-7 tt]# ln -s a.txt sa.txt[root@ecs-centos-7 tt]# ls -iltotal 4131096 -rw-r--r-- 1 root root 15 Aug 25 20:19 a.txt131100 lrwxrwxrwx 1 root root 5 Aug 25 20:22 sa.txt -> a.txt[root@ecs-centos-7 tt]# stat a.txt | grep LinksDevice: fd01h/64769d Inode: 131096 Links: 1
������������������������������ a.txt ������������ sa.txt ������������������������������������������������������������ ->
������������������������
������������������������ stat a.txt | grep Links
��������������������������� a.txt ������������������������������������������������������������������������������������������������
- ������������������������
[root@ecs-centos-7 tt]# mkdir tmp[root@ecs-centos-7 tt]# ln -s tmp/ stmp[root@ecs-centos-7 tt]# lltotal 4lrwxrwxrwx 1 root root 4 Aug 26 00:38 stmp -> tmp/drwxr-xr-x 2 root root 4096 Aug 26 00:38 tmp[root@ecs-centos-7 tt]# echo "1234" > stmp/a.txt[root@ecs-centos-7 tt]# cat tmp/a.txt 1234
- ���������������������������������
���������������������������������������������������
[root@ecs-centos-7 tt]# df -hFilesystem Size Used Avail Use% Mounted ondevtmpfs 909M 0 909M 0% /devtmpfs 919M 0 919M 0% /dev/shmtmpfs 919M 8.7M 911M 1% /runtmpfs 919M 0 919M 0% /sys/fs/cgroup/dev/vda1 40G 20G 18G 53% /tmpfs 184M 0 184M 0% /run/user/0
������������������������������������������ devtmpfs, tmpfs, /dev/vda1
��������������������������������� tmpfs
��� /dev/vda1
������������������������������������������������������������
[root@ecs-centos-7 tt]# touch /run/test.txt[root@ecs-centos-7 tt]# cat /run/test.txt [root@ecs-centos-7 tt]# ln -s /run/test.txt /st.txt[root@ecs-centos-7 tt]# echo "haha" > /st.txt [root@ecs-centos-7 tt]# cat /run/test.txt haha
������������������������������ tmpfs
���������������/run
��������������� test.txt
���������������������������������������
������������/dev/vda1
���������������/
������������ /run/test.txt
������������ st.txt, ��������� st.txt ������������������ haha
��������������������������� /run/test.txt
, ������������������������������������
������������������������
���������������������������������������������������������������������������
- ���������������
������������������������������������������������������������������������������������������������������������������������������������
[root@ecs-centos-7 tt]# cat sa.txt this is a file[root@ecs-centos-7 tt]# cat a.txt this is a file[root@ecs-centos-7 tt]# echo "111" >> sa.txt [root@ecs-centos-7 tt]# cat sa.txt this is a file111[root@ecs-centos-7 tt]# cat a.txt this is a file111
������������������������ sa.txt ������������������������������ a.txt ���������������������������������
- ������������������
��������������������������������������������������������������������������������������������������������������������������������������������������������������� a.txt ������������������������������������������������������������������������
������cat sa.txt
���������������������������������������������������
������������������
������������������������������������, ���������������������������������������������(������������������������������������ )
���������������������������������������������������������������������������������������������������������������������������������������������������������
������ c/c++ ������������������������������������������������������������������������������������������������������������������������������������������
���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������(������������������������������������������������������������)
���������������������������������
- ���������������
���������������������: ln ��������� ���������
[root@ecs-centos-7 tt]# stat b.txt | grep LinksDevice: fd01h/64769d Inode: 131096 Links: 1root@ecs-centos-7 tt]# ln b.txt hb.txt[root@ecs-centos-7 tt]# ls -litotal 8131096 -rw-r--r-- 2 root root 17 Aug 25 23:40 b.txt131096 -rw-r--r-- 2 root root 17 Aug 25 23:40 hb.txt[root@ecs-centos-7 tt]# stat b.txt | grep LinksDevice: fd01h/64769d Inode: 131096 Links: 2
������������������������������ b.txt ������������ hb.txt
��������������������� stat b.txt | grep Links
��������������� b.txt ���������������������������������������������������������������������������������������
- ������������������������������������
������������������������������������������������������������������������������������������������������������������������������������������������������������������
���������������������
- ������������������������������������
[root@ecs-centos-7 /]# ln /run/test.txt /htest.txtln: failed to create hard link ���/htest.txt��� => ���/run/test.txt���: Invalid cross-device link
- ���������������������������������
[root@ecs-centos-7 tt]# ln tmp/ htmpln: ���tmp/���: hard link not allowed for directory
������
���������������������������������������������������������������������������������������������
������ | ��������������� | ������ | ������ | ������������������ | ��������������� | ��������������������������� |
---|---|---|---|---|---|---|
��������� | ������������������ | ��������������������������������� | ��������������������� | ��� | ��� | ������������ |
��������� | ��������������������� | ��������������������� | ��������������������� | ������ | ������ | ��������� |
������������
发表评论
最新留言
关于作者
