What to do with all these broken symlinks?

I just read the passage below from ArchWiki:

Old, broken symbolic links might be sitting around your system; you should remove them. Examples on achieving this can be found here and here. However, you should not blindly delete all broken symbolic links, as some of them serve a purpose [1].

To quickly list all the broken symlinks of your system, use:

#find / -xtype l -print

Then inspect and remove unnecessary entries from this list.

https://wiki.archlinux.org/title/Maintenance#Broken_symlinks

The given command above produces literally hundreds of lines of output, majority of them related to flatpak.

Please see: http://ix.io/3ov8

What do I do with all these broken symlinks? Seemingly it is recommended to review the list and remove those “unneeded”. It appears to me as a Herculean task. What would you suggest that I should be doing?

Either ignore them or go through the list and remove them as desired?

I am not sure what the other options could be…

Keep in mind, you could remove them in chunks. For example, if you wanted to remove all the flatpak related ones at once you could do something like:

sudo find /var/lib/flatpak -xtype l -exec rm {} \;

That being said, I am not advising you do to that. Just providing an example of one way it can be accomplished :wink:

Personally, I tend to ignore them unless I stumble across something broken.

1 Like

Thanks @dalto for the reply!

I think I will follow your example and leave them alone for the moment. I also keep a note of the command you provided in case I want to remove all those broken flatpak symlinks. Thanks for that!

1 Like

As a side note, I am not a big flatpak user but I think those broken symlinks are normal for flatpak.

Alright. I didn’t know that!
It was actually the first time I ran the find-broken-symlink command and I was a bit surprised that there were so many of them.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.