How to find “dead” symbolic links with a simple Bash script

In a previous post I talked about how to find dead symbolic links on your filesystem.
You can read about that here: How to find “dead” symbolic links

I’d liked to be able to run this command with less typing, so I created the following script:

Save it to /usr/local/bin/deadlinks or ~/bin/deadlinks

Set the right permissions

You can call it with the -d argument to find and delete the link if it is broken.