How do you find the symbolic links to files.

Marcus J. Ranum mjr at hussar.dco.dec.com
Wed Nov 28 06:16:33 AEST 1990


jonb at specialix.co.uk (Jon Brawn) writes:
>>>Does 'find' have a wonderful flag for finding symlinks?
>>	read the manual page on find(1).

>Hmm. And? SCO Unix doesn't appear to document it - hang on a mo I'll
>look at Interactive...
>...nope. So, having RTFM, I find nothing useful. The question remains
>unanswered.

	Use "find dir -type l -print" to print the name of symlinks.

Sorry I reflexively RTFM'd you - it's surprising that a vendor would
sell a UNIX with symlinks and *NOT* have readlink(2), lstat(2), the
-l option to find, etc, etc, etc [or some similar and documented
features]. In fact, I would not purchase such a UNIX, if I knew of one.

Since your version(s?) of UNIX (SCO/interactive?) appear to be missing
stuff, according to you, all bets are off - so I'll tell you how
ULTRIX/BSD handle these things.

>I know how tar and cpio handle regular files and device nodes. I want to
>know about symbolic links.

	tar with the -h makes a copy of the contents of the symbolic
link, otherwise it defaults to just storing information about the
link so it can recreate the link.

>[...] When something new comes along, I
>like to be able to ask those more priviledged than myself for
>enlightenment, so they can look in their manuals and say, 'Theres
>this new O/S call [...]

	That's why I think Barry and I RTFM'd you - it's *NOT*
new stuff, it's been around for several years, and that's forever
at the rate new stuff gets kluged into UNIX these days. :) Plus, your
original postings somehow led me to think you had symlinks on your
machine(s?) - I'm surprised anyone would buy a UNIX that had symlinks
but no decent ways to examine them, etc. If you do an "ls -l" (or -L?)
does "ls" display the links ? If so, your machine probably does have
lstat(2) - try to write a program that calls it (just like stat) and
if it's not in TFM, then complain to the vendor.

mjr.
-- 
	Good software will grow smaller and faster as time goes by and
the code is improved and features that proved to be less useful are
weeded out.	[from the programming notebooks of a heretic, 1990]



More information about the Comp.unix.internals mailing list