aboutsummaryrefslogtreecommitdiff

title: Find broken symlinks with "find"

date: 2020-11-08

layout: post

lang: en

ref: find-broken-symlinks-with-find

eu_categories: shell


The find command knows how to show broken symlinks:

find . -xtype l

This was useful to me when combined with Git Annex. Its wanted option allows you to have a "sparse" checkout of the content, and save space by not having to copy every annexed file locally:

git annex wanted . 'exclude=Music/* and exclude=Videos/*'

You can find any broken symlinks outside those directories by querying with Git Annex itself, but find . -xtype l works on other places too, where broken symlinks might be a problem.