How to know or to list all the soft and hard links an installed distribution has !

Can someone please help me out with this !
I wish to know how many soft & hard links ( and linked with what ) are there in an installed distro ?

What command and what options to put in the command line ( as root off course ) to find that out ??? … I looked at the man pages for the command “find” ! … but could not come up with the right arguments & options to have the result wanted ! … can someone please fork me a command from the command line ! …

How do I know how many and what soft and hard links ( with what ) … are there in an installed linux distro ? … thank you !

Don

PS. It seems that This is not a simple task ! but should be do-able !

On 07/08/2011 01:36 PM, Ls Don X wrote:
>
> I wish to know how many

i wonder why you wish to know?
especially when the answer is too hard for you to find?

no, i can’t build a find statement to answer your question…but, can
you answer my questions above, and below?

Didn’t you see that BIG BANNER at the top of the page which says “Please
don’t ask product questions here . . . This forum is NOT for asking
questions . . .”

> PS. It seems that This is not a simple task ! but should be do-able !

to me, it seems that reading is also a simple task which should be do-able…


DD
-Caveat-Hardware-Software-

On 2011-07-08 13:36, Ls Don X wrote:
> Can someone please help me out with this !
> I wish to know how many

Er… no.

This forum is not where you ask how to do things, but where you explain to
us how to do things.

Mods, please move this thread.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Whooopssss … I am truly sorry guys !!! … My bad !! … I’ll take it down !! … Thank you DenverD, robin_listas … DenverD … I’ll take you on your offer … thx … I am sorry again …

HOW DO i MOVE THIS THREAD ELSEWHERE … I WANTED TO DELETED IT … AND START IT SOMEWHERE ELSE … ssshuuuttt … i CANNOT !! …

this ii going to be mov ed, please do not post until moved.

Moved to programmig and scripting.

Number of softlinks:

find / -type l | wc -l

Number of hardlinks:

 find /  ! -type d -a ! -links 1 | wc -l

Number of files hardlinked:

 find /  ! -type d -a ! -links 1 -ls | awk '{print $1}' | sort -u | wc -l

Notice that the number of hardlinks doesn’t really make sense. Is a file who has hardlinks a hardlink itself? Which came first, the chicken or the egg? The solution has more metaphysics than mathematics.

I’m not 100% sure about the commands … but the answer seems sooooooooo irrelevant that I’m tempted to say:* lieber eine Stunde Psychologie!* rotfl!

Why do you want to know? Are you doing some kind of rating of distros by the number of links or what? My imagination fails to come up with a reason why these numbers are relevant. It’s like asking how many bolts are used in a car, just a manufacturing detail, irrelevant to the performance of the car.

Hmmm … I used to work in a car factory and I can tell you that the number of bolts is indeed relevant to the performance - and safety - of the car, especially when you replace a part and end up with some extra bolts. lol!

Sure, if you go around deleting links on your distro, you will break something. :stuck_out_tongue:

But what he was asking is is similar to asking if a car from mfr A with 1013 bolts worse than a car from mfr B with 1624 bolts. :wink:

Hi,

<Rant>

Aww guys, c’m on!

The guy just wants to know.

Isn’t that what this list is about? Not knowing something and then asking here?
Why criticize him for wanting to find something out about his distro?
Isn’t that one of the beauties of Linux? Get to know your OS?
So what if YOU can’t find a reason for his question. Do we now have to justify ourselves before asking a question?
I can’t find anything in his post where he says he’s going to compare any distro with another based on the number of links - who made that up?

</Rant>

@LS_Don_X
Sorry, but I just don’t know the anwser.
Have you tried Please_try_again’s suggestions? Do they work?

Lenwolf

It’s not a criticism, I’m just curious what his motivation is. Often people think they have to do things one way, but when you find out what they really want, there are better ways to do it.

If I wanted to make my LFS ( Linux From Scratch ) be almost 100% compatible with OpenSuse/YAST and their packages, I will need to know all the links in openSUSE so I can replicate them in my home distro … don’t you think ??? … it’s just a test … but lots of work … I know … it is one hell of an adventure ! … would you have any ideas ! … I am still stuck with compiling & installing YAST into it ! … but that will be another post & subject all together !

Not necessarily. Just replicating a link without understanding the reason for it is a monkey see monkey do strategy that could have you chasing red herrings. There are various reasons why links are used. The obvious ones are to provide aliases for common commands, like vim and vi. Another is to provide a level of redirection from /etc/alternatives. But there are subtle uses such as in naming shared libraries where there is a method to the madness.

Thank you for your input & initiative … it is very much appreciated !

the first command seems to work … until it tells me permission denied !

the others … stopped after just a few lines and also tell me : permission denied !

while I run them as root

!!???

Change to the directory (mount point) where you want to start the search and remove the first “/”. You should not have permission denied while running this command as root.

Instead of searching everything from / you might want to restrict to those directories that are managed by the packaging system, and not devices, pseudo-files, user files, mount points, or temp directories. Probably this list: bin boot etc lib lib64 opt sbin srv usr var

"… Another is to provide a level of redirection from /etc/alternatives … "

These ones are the ones that mostly interest me and is very relevant in my endeavor !! … the other ones … I agree with you … it would me madness ! …

When doing LFS … you build these links as you go along … and can add ones yourself if deemed necessary depending on what you are installing from source ! and what sources you modified to do this or that … or to access this or that library … etc …!! …

many links will be the same throughout many linux distros out there …

From what I have gathered … OpenSUSE happen to have certain links that no other distro have … FIRST : I wish to identify them all … if possible … and take it from there …

FYI … the exercise is not to replicate them in a vulgar and automatic way as you suggested … there are rules and ways to go about them … identifying the packages or programs that use them etc …

I guess … you cannot be part of the solution that I am seeking ! … if you have a creative suggestion … please feel free to share ! … you know now why I am doing this !

or a simple question might be : what are the links only related to the openSUSE distro and why … ??? most people will not find the answer to that question for me ! … or will simply not tell me !

cheers.

BTW hardlinks are not important. Depending on how you create packages/archives, you may save the hardlinks or lose them. I already introduced hardlinks in some BSD installations - where they were missing - to save place or lost some others and ended up with duplicate files while copying between different filesystems (hardlinks have to be on the same filesystem, i.e partition). You don’t need to know how many hardlinks there are. Softlinks on the contrary are important. You don’t need to know how many there are but you need to know where they point to. The command readlink might be helpful (man readlink) .

Ooooops ! Can we still be part of the problem by chance?