Insights on Ruby, Git, jQuery, Cappuccino, WordPress, Debian and OS X. Please subscribe if you find something useful!

Managing Broken Symlinks

Posted: November 5th, 2009 | Author: Jerod | Filed under: Bash | Tags: , , | View Comments

I just added two new functions to my bashrc which make it super-simple to find & remove broken symbolic links on your system.

They’re simple wrappers around the ever-useful “find” utility:

function find_broken_symlinks() { find -x -L "${1-.}" -type l; }
function rm_broken_symlinks() { find -x -L "${1-.}" -type l -exec rm {} +; }

You can call the functions with a specific path:

jerod@mbp:~$ find_broken_symlinks /usr/local/bin

Or you can call them sans argument to search your current working directory:

jerod@mbp:~$ find_broken_symlinks

Enjoy!


View Comments on “Managing Broken Symlinks”

  1. 1 air jordan 9 said at 6:15 am on July 13th, 2010:

    I've been looking for a similar to this post. Not only extensively but also detailly. We can learn a lot from the post. moncler jackets I recommend to you , ugg boots sale you can come communication in here. Let us grow up together.On the other hand ,I know some websites content is very well.you can go and see.Such asugg boots for sale

blog comments powered by Disqus