Script to identify working symlinks in a folder

Tags: findscriptsoftlink

Published on: September 12, 2014 by Arnold Pablo

Script to identify working symlinks in a folder


There could be situations where you see lots of dead symbolic links inside a folder. As in the example below there are 15828 symbolic (soft links) but there are only 188 files which are working symblolic links while all others are dead. So we need a way to identify working symlinks in a folder.

# ls -lst | wc -l
Command to identify working symlinks inside a folder is to execute the below command.
find /dir/to/check -type l ! -xtype l
While googling, you may find options to use find . -L -type l .. DON’T USE THIS. It may cause unexpected results.
Get 24/7 expert server management

Category : Howtos, Linux, Troubleshooting

Arnold Pablo

Arnold Pablo

Technology always fascinated me and continues to do so. I started my career back in 2004 as a Junior System Admin and worked in various capacities both in technical and managerial roles. I love to experiment and try out new OSS projects and in free time, go for cycling to the interiors of God's own country, Kerala!

You may also read:


Add new commentSIGN IN

Let's Connect


Your Cart

Cart is empty.

Send this to a friend