Link:https://www.moreofless.co.uk/linux-difference-soft-symbolic-link-and-hard-link/

This example shows the difference between a soft (also known as a symbolic link) and a hard link on a Linux system:

echo "hello" > a  ---> create a file called "a"
ln a b ---> create hard link called "b" to "a"
ln -s a c ---> create soft link called "c" to "a"

No surprises here, printing the contents of files a, b and c produce the same result:

cat a ---> hello
cat b ---> hello
cat c ---> hello

Now we remove the original “a” file:

rm a

And the difference between the two links become obvious:

cat a ---> No such file or directory
cat b ---> hello
cat c ---> No such file or directory

The soft link is essentially a pointer to the original file and when the original file is deleted the soft link does not point to anything and so “no such file or directory” is reported. The hard link acts more like a mirror of the original file, it actually points to the same “node” in the filesystem that the original “a” file points to, so when we delete the original file “a” the file “c” still points to the same (and still existing) node in the filesystem.

转载:Linux: What’s the difference between a soft link and a hard link?的更多相关文章

  1. [转载]Linux进程调度原理

    [转载]Linux进程调度原理 Linux进程调度原理 Linux进程调度的目标 1.高效性:高效意味着在相同的时间下要完成更多的任务.调度程序会被频繁的执行,所以调度程序要尽可能的高效: 2.加强交 ...

  2. [转载]Linux下非root用户如何安装软件

    [转载]Linux下非root用户如何安装软件 来源:https://tlanyan.me/work-with-linux-without-root-permission/ 这是本人遇到的实际问题,之 ...

  3. [转载]Linux 命令详解:./configure、make、make install 命令

    [转载]Linux 命令详解:./configure.make.make install 命令 来源:https://www.cnblogs.com/tinywan/p/7230039.html 这些 ...

  4. [转载]Linux缓存机制

    [转载]Linux缓存机制 来源:https://blog.csdn.net/weixin_38278334/article/details/96478405 linux下的缓存机制及清理buffer ...

  5. 转载 linux内核 asmlinkage宏

    转载http://blog.chinaunix.net/uid-7390305-id-2057287.html 看一下/usr/include/asm/linkage.h里面的定义:#define a ...

  6. [转载] Linux启动过程详解-《别怕Linux编程》之八

    本原创文章属于<Linux大棚>博客,博客地址为http://roclinux.cn.文章作者为rocrocket.为了防止某些网站的恶性转载,特在每篇文章前加入此信息,还望读者体谅. = ...

  7. [转载]Linux命令笔记

    *以下内容均来自于网络转载,感谢原作者分享 <对Linux新手非常有用的20个命令> 传送门 英文原文为“Switching From Windows to Nix or a Newbie ...

  8. [转载] Linux下高并发socket最大连接数所受的各种限制

    原文: http://mp.weixin.qq.com/s?__biz=MzAwNjMxNjQzNA==&mid=207772333&idx=1&sn=cfc8aadb422f ...

  9. [转载]linux下svn常用指令

    一下内容转载于:http://blog.chinaunix.net/space.php?uid=22976768&do=blog&id=1640924.这个总结的很好~ windows ...

随机推荐

  1. 第一次使用Git Bash Here 将本地代码上传到码云

    当我们安装成功git工具时候,初次使用Git时,需要Git进行配置. 1.点击桌面上的这个图标,打开Git Bash:如图所示 2.配置自己的用户名和邮箱 git config --global us ...

  2. win10 + Ubuntu 20.04 LTS 双系统 引导界面美化

    版权声明:本文为CSDN博主「ZChen1996」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明. 原文链接:https://blog.csdn.net/ZChen1 ...

  3. C++指针变量的基本写法

    指针变量与应用——动态数组 在C++中,有一种神奇的变量,它不可以表示一个值,但是可以表示某个元素的地址,通过地址来访问这个元素. 打个比方:你有一张地图和一个坐标,你就可以通过访问这个坐标来达到你访 ...

  4. RSA非对称加密(java实例代码)

    使用RSA对WebService传递的信息加密解密的基本思想是:服务器端提供一个WebService方法String getServerPublicKey(),客户端可以以此得到服务器端的公钥,然后使 ...

  5. Finding the Right EAV Attribute Table

    $customer = Mage::getModel('catalog/product'); $entity = $customer->getResource(); $attribute = M ...

  6. cinder-volume服务上报自己的状态给cinder-scheduler的rpc通信代码分析

    以juno版本为基础,主要从消息的生产者-消费者模型及rpc client/server模型来分析cinder-volume是如何跟cinder-scheduler服务进行rpc通信的 1.cinde ...

  7. 下拉菜单,下拉导航,JavaScript,html,jQuery的实现代码

    <!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8 ...

  8. webstorm激活码2020--定期更新

    2020年8月22日更新 一般错误关闭软件重填即可,key is invalid 错误需要恢复破解或者重装,才能使用 V8AF5QDT5R-eyJsaWNlbnNlSWQiOiJWOEFGNVFEVD ...

  9. 第3关-input()函数

    第3关-input()函数 一.input()函数 import time print('亲爱的同学:') time.sleep(1) print('我们愉快地通知您,您已获准在霍格沃茨魔法学校就读. ...

  10. 用Springboot+Jpa实现学生CRUD操作(含前端页面,含分页,自定义SQL)

    前期准备 使用idea新建个SpringBoot项目 参考博客:https://blog.csdn.net/Mr_Jixian/article/details/89742366?tdsourcetag ...