[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: find -links n

From: James Youngman
Subject: Re: find -links n
Date: Tue, 16 Jul 2013 08:21:18 +0100

On Sun, Jul 14, 2013 at 8:49 PM, Günter Wallnig <address@hidden> wrote:
> Hello James,

Hello.   I notice that you replied only directly to me as a followup
to my earlier post.  As a general rule, this is a bad idea; it limits
the number of people who can help you and also the person you emailed
then has the sole burden of helping you.    It is generally better,
when discussing a request for help, to keep the discussion on the list
(unless some detail is necessarily private).

> here are some more details:
>> ls -il
>> 164407 drwxr-x--- 2 guenter guenter   4096 2013-07-14 11:23 Ablage
> it's a directory
>> find -links 2
>> ./Ablage
> this directory is't linked anyway. There are no files or other directories
> inside

Empty directories on normal Unix-like file systems have a link count
of 2.  This is because they contain an entry called "." which points
to the directory itself, as well as the directory entry in the parent.

If you take an empty directory and create a sub-directory inside it
you will also see that the new child's ".." entry (which points to the
new child's parent) causes the link count on the parent to change from
2 to 3.

There is a clearer description of this, with a diagram, in section
4.14 of Richard Stevens' "Advanced Programming in the UNIX
Environment", a book I'd strongly recommend.   There's also a somewhat
less clear but useful explanation at

> Am 14.07.2013 21:18, schrieb James Youngman:
>> On Sun, Jul 14, 2013 at 11:19 AM, Günter Wallnig <address@hidden> wrote:
>>> Hello, people,
>>> I believe to have found a mistake in "find" with the param "-links":
>>> Apparently, only the second Column of the output of "ls" looks at what is
>>> probably wrong with a directory!
>>> Sincerely yours
>>> G. Wallnig
>>> Please excuse my bad English!
>> I'm sorry, but from what you wrote I'm not able to understand the
>> problem you're trying to point out.  Please try again, providing more
>> detail.
>> What command did you use, precisely?
> see above
>> What result did you expect, precisely?
> only real (hard) linked files
>> What result did you get, precisely?
> see above
>> Why do you think that's wrong?
> I think, the command is normally used to find linked files. directories
> can't hard linked ... a soft link doesn't exist there. The directory is
> empty.
>> Which version of GNU findutils are you using?
>> find --version
>> find (GNU findutils) 4.4.2
>> Copyright (C) 2007 Free Software Foundation, Inc.
>> License GPLv3+: GNU GPL version 3 or later
>> <http://gnu.org/licenses/gpl.html>
>> This is free software: you are free to change and redistribute it.
>> There is NO WARRANTY, to the extent permitted by law.
>> Written by Eric B. Decker, James Youngman, and Kevin Dalley.
>> Erzeugt mit der GNU gnulib Version
>> e5573b1bad88bfabcda181b9e0125fb0c52b7d3b
>> Aktivierte Eigenschaften: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION
>> FTS() CBO(level=0)
>> Can you reproduce the same effect using the newest version on
>> ftp.gnu.org/pub/gnu/findutils?
> there are no newer version
> Here are some more information about system:
>> uname -r
>> 2.6.38-16-generic
>> cat /proc/version_signature
>> Ubuntu 2.6.38-16.67-generic
>> cat /etc/debian_version
>> squeeze/sid
>> cat /etc/lsb-release
>> DISTRIB_ID=Ubuntu
> I hope this helps?
> Günter

This email is intended solely for the use of its addressee, sender,
and any readers of a mailing list archive in which it happens to
appear.   If you have received this email in error, please say or type
three times, "I believe in the utility of email disclaimers," and then
reply to the author correcting any spellings (and, optionally, any
incorrect spellings), accompanying these with humorous jests about the
author's parentage.   If you are not the addressee, you are
nevertheless permitted to both copy and forward this email since
without such permissions email systems are unable to transmit email to
anybody, intended recipient or not.  To those still reading by this
point, the author would like to apologise for being unable to maintain
a consistent level of humour throughout this disclaimer.  Contents may
settle during transit.  Do not feed the animals.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]