Home » Questions » Computers [ Ask a new question ]

finding files with most links

finding files with most links

how can i find top 10 files in unix with most links to it?

Asked by: Guest | Views: 30
Total answers/comments: 1
Guest [Entry]

"I don't believe there's anything about a file which tells you how many links there are to it.

If I'm right, you'll have to search your directory tree for links and sort them by the file they link to.

The find command can list links with -type l but unless you use find's special handling of links, you don't see what the link resolves to.

So try:

sudo find -L / -type l -exec ls {} \;

to list links. Then redirect the output to sort, uniq and so on.

I haven't tested this (it's not complete, anyway): I'm not sure if I have any duplicated links to find in my filesystem which would make a test meaningful."