7ehost
全球服务器主机

CentOS下如何查看一个文件的硬链接数?

用ls -l 可以看到有一个文档的硬链接数:

[root@localhost tmp]# ls -li

total 104

229415 drwxr-xr-x  2 root root 4096 Dec 11 21:15 etc

 39757 -rw-r–r–  2 root root 1602 Oct 30 14:56 hl_passwd

用一下语句可以查看一个文件有哪些硬链接

[root@localhost tmp]# find / -inum 39757

find: /proc/6266/task/6266/fd/4: No such file or directory

/etc/passwd

/tmp/hl_passwd

但是注意由于硬链接是不能跨文件系统的,所以

 Add the `-xdev’ option if you are starting the

search at a directory that has other filesystems mounted on it,

未经允许不得转载:7eHost全球服务器资源 » CentOS下如何查看一个文件的硬链接数?

更好的更稳定的服务器

7EHOST从事服务器多年经验积累和风险预测,确保企业型服务能够满足我们大/小客户需求。所有机房电话,邮件,工单提供24/7/365全年全天候技术支持,服务器在线率99.99%。

联系我们联系我们