メモ:リンク切れになっているシンボリックリンクをfindで見つける

find . -xtype l

で探せるらしい。

-xtypeって知らなかった。man findを見ると、

       -xtype c
              The same as -type unless the file is a symbolic link.  For symbolic links: if the -H or -P option
              was specified, true if the file is a link to a file of type c; if the -L option has been given, true
              if  c  is `l`.
              In other words, for symbolic links, -xtype checks the type of the file that -type does not check.

となっている。-typeと違ってシンボリックリンクの先まで追ってファイルを判定する(ちなみに、findは何も指定しないと-Pがデフォルトの動作)。 で、シンボリックリンクの先まで追ってるのになおシンボリックリンクということは、リンクしてる先にファイルがない、ということらしい。分かりづらい…