当前位置:网站首页>Soft link & hard link
Soft link & hard link
2022-07-29 05:13:00 【perseverance_ draxler】
[email protected]:/home/shay/Documents/test# cat lnkt2
hello world
[email protected]:/home/shay/Documents/test# ls
lnkt2
[email protected]:/home/shay/Documents/test# ln lnkt2 lnkt1
[email protected]:/home/shay/Documents/test# mkdir testdir1
[email protected]:/home/shay/Documents/test# mv lnk2 ./testdir1/
mv: cannot stat 'lnk2': No such file or directory
[email protected]:/home/shay/Documents/test# mv lnkt2 ./testdir1/
[email protected]:/home/shay/Documents/test# ls
lnkt1 testdir1
[email protected]:/home/shay/Documents/test# tree .
.
├── lnkt1
└── testdir1
└── lnkt2
1 directory, 2 files
[email protected]:/home/shay/Documents/test# ln testdir1 testdir2
ln: testdir1: hard link not allowed for directory
[email protected]:/home/shay/Documents/test# ln -s testdir1 testdir2
[email protected]:/home/shay/Documents/test# ls
lnkt1 testdir1 testdir2
[email protected]:/home/shay/Documents/test# cd testdir2
[email protected]:/home/shay/Documents/test/testdir2# ls
lnkt2
[email protected]:/home/shay/Documents/test/testdir2# cat lnkt2
hello world
[email protected]:/home/shay/Documents/test/testdir2# cd ..
[email protected]:/home/shay/Documents/test# rm -rf testdir1
[email protected]:/home/shay/Documents/test# ls
lnkt1 testdir2
[email protected]:/home/shay/Documents/test# ll
total 12
drwxr-xr-x 2 root root 4096 Jul 9 02:24 ./
drwxr-xr-x 15 shay shay 4096 Jul 9 02:12 ../
-rw-r--r-- 1 root root 12 Jul 9 02:13 lnkt1
lrwxrwxrwx 1 root root 8 Jul 9 02:17 testdir2 -> testdir1
Concept reference :
Detailed explanation of soft links and hard links | 《Linux It's time to learn 》
INODE Definition and metadata
What is an inode?
Linux must allocate an index node (inode) for every file and directory in the filesystem. Inodes do not store actual data. Instead, they store the metadata where you can find the storage blocks of each file’s data.
Metadata in an inode
The following metadata exists in an inode:
- File type
- Permissions
- Owner ID
- Group ID
- Size of file
- Time last accessed
- Time last modified
- Soft/Hard Links
- Access Control List (ACLs)
Reference resources :
problem 1:cp -l and ln What's the difference? ?
The result of execution is indistinguishable , Are hard links , The difference lies in cp -l Recursion can be attached .
Reference resources :hard link - Is there a difference between hardlinking with cp -l or ln? - Unix & Linux Stack Exchange
边栏推荐
- [file download] easyexcel quick start
- How to add traffic statistics codes to the legendary Development Zone website
- Use openmap and ArcGIS to draw maps and transportation networks of any region, and convert OMS data into SHP format
- What if the computer cannot open excel? The solution of Excel not opening
- Improve the readability of your regular expressions a hundred times
- 自贸经济中架起的“隐形桥梁”:国货精品与中国AI力量
- How to open IE browser by running win command
- Mysql的自连接和联合查询
- The representation of time series analysis: is the era of learning coming?
- MySQL regularly calls preset functions to complete data update
猜你喜欢
Excel卡住了没保存怎么办?Excel还没保存但是卡住了的解决方法
如何让照片中的人物笑起来?HMS Core视频编辑服务一键微笑功能,让人物笑容更自然
一文带你搞懂环绕通知@Around与最终通知@After的实现
【2022新生学习】第三周要点
On prepayment of house purchase
基于注解的三层项目的改造及添加包扫描的方式
excel怎么设置行高和列宽?excel设置行高和列宽的方法
What if the office prompts that the system configuration cannot run?
学习数据库的第一个程序
office2010每次打开都要配置进度怎么解决?
随机推荐
[2022 freshmen learning] key points of the third week
自贸经济中架起的“隐形桥梁”:国货精品与中国AI力量
How to solve the problem of configuring the progress every time Office2010 is opened?
Operator operation list of spark
js(forEach)出现return无法结束函数的解决方法
Mysql把查询到的结果集按指定顺寻进行排序
MySQL定时调用预置函数完成数据更新
How to add a map to the legendary server
Google gtest事件机制
JS daily question (12)
Deep learning brush a bunch of tricks of SOTA
A little knowledge about management
向往的开源之多YOUNG新生 | 从开源到就业的避坑指南来啦!
The difference between the two ways of thread implementation - simple summary
网安学习-内网安全1
Word如何查看文档修改痕迹?Word查看文档修改痕迹的方法
虚拟偶像的歌声原来是这样生成的!
2021-10-23
AUTOSAR from introduction to proficiency 100 lectures (78) -autosar-dem module
那个准时上下班,从不愿意加班加点的人,在我前面升职了...