Chinaunix

标题: 想找到文件系统中所有的硬连接 [打印本页]

作者: jiannma    时间: 2009-02-19 19:55
标题: 想找到文件系统中所有的硬连接
想找到文件系统中所有的硬连接Shell该如何写呢,那位大虾能帮小弟我啊???:wink:
作者: Celinde    时间: 2009-02-20 01:41

to 楼下,man里面咋没说可以用+1这样的方法涅

[ 本帖最后由 Celinde 于 2009-2-20 09:11 编辑 ]
作者: happyc84    时间: 2009-02-20 09:06
find / -type f -links +1
作者: Celinde    时间: 2009-02-20 09:14
我真郁闷了,555
看到了,-links的上上面有说明说..


  1.    TESTS
  2.        Numeric arguments can be specified as

  3.        +n     for greater than n,

  4.        -n     for less than n,

  5.        n      for exactly n.


复制代码

作者: happyc84    时间: 2009-02-20 09:15
标题: 回复 #4 Celinde 的帖子
不可能全部都记住的

我也是看了问题搜索出来的
作者: happyc84    时间: 2009-02-20 09:29
标题: 回复 #2 Celinde 的帖子
我也不知道 man  太长了 我都不看的
google来的 起先我是想要是能读到连接数在判断就可以了
然后搜索find 连接数 然后做试验 发现可以工作但是目录也是2的连接数 再加type f
作者: Celinde    时间: 2009-02-20 09:44
我直接看man去了... 发现-links参数,说明很短..:
-links n
              File has n links.
我没办法了,只好用所有文件减去只有一个link的文件,好在文件的link不能是0或者负数...

刚看了你的办法又去看了下man,发现高高在上的真的有说N可以是 +n -n  n
我,闪去墙角画圈圈了..
作者: jiannma    时间: 2009-02-25 17:58
谢谢大家  问题解决了
作者: jiannma    时间: 2009-02-25 18:00
顺便请教下怎么查找机子上的所有 软连接呢?
作者: Celinde    时间: 2009-02-25 18:18
#man find


  1.       -type c
  2.               File is of type c:

  3.               b      block (buffered) special

  4.               c      character (unbuffered) special

  5.               d      directory

  6.               p      named pipe (FIFO)

  7.               f      regular file

  8.               l      symbolic link; this is never true if the -L option or the
  9.                      -follow  option is in effect, unless the symbolic link is
  10.                      broken.  If you want to search for symbolic links when -L
  11.                      is in effect, use -xtype.

复制代码

作者: jiannma    时间: 2009-02-25 18:34
明白了 是find . -type l -ls




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2