What is a hardlink and how to create one?

博客围绕Red Hat Enterprise Linux 5、6、7系统展开,提出如何创建硬链接、识别硬链接以及硬链接和软链接区别等问题,并给出识别硬链接的示例及软硬链接差异相关内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

https://access.redhat.com/solutions/2954831

 SOLUTION UNVERIFIED - 已更新 2017年十一月15日03:16 - 

English 

环境

Red Hat Enterprise Linux 5
Red Hat Enterprise Linux 6
Red Hat Enterprise Linux 7

问题

How to create Hardlinks in Red Hat Enterprise Linux?
How to identify Hard Links?
Difference between soft link and hard link.

决议

  • How to identify Hard Links

Raw

In case two files displaying the same inode, then these are hard links.
  • Find below as an example to create a hard link:

Raw

# ln file1 file2
# ls -li
total 20
9962464 -rw-r--r-- 2 guru users 8 Mar  9  file1
9962464 -rw-r--r-- 2 guru users 8 Mar  9  file2
  • Difference between soft and hard links:

Raw

Soft Links:
         Soft Links can be created across file systems.
         Soft link has a different inode number than the original file.
         On deleting the original file, soft link cannot be accessed. 
         Soft link needs extra memory to store the original file name as its data.
         Source file need not exist for soft link creation.
         Can be created on a file or on a directory.
         Access to the file is slower due to the overhead to access file. 

Raw

Hard Links:
         Hard links can be created only within the file system.
         Hard links have the same inode number as the original file.
         On deleting the original file, hard linked file can still be accessed.
         Hard links do not need any extra data memory to save since it uses links
         Source file should exist.
         Can be created only on files, not on directories.
         Access  to the file is faster compared to soft link.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值