Reese Knowledgebase

How to find dead links and delete them

View Kristian Reese's profile on LinkedIn


If you like this article, please +1 or Recommend via FB with the provided buttons above:

Article ID: 76
by: Reese K.
Posted: 08 Nov, 2012
Last updated: 08 Nov, 2012
Views: 1433

Sometimes, after performing VPS migrations, the soft links in /etc/vz/conf may not be removed.  Over time, the dead links may build up and cause many 'No such file or directory' messages when trying to look for common settings amonst all conf files (ie cat /etc/vz/conf/*.conf  | grep whatever).

Quick easy way to delete these dead links:

~# cd /etc/vz/conf

~# for f in `find . -type l ! -exec test -r {} \; -print`; do rm -f $f; done

One liner:

~# find -L -type l -exec rm -f {} \;

* Please test before issuing these commands on production systems!!

This article was:   Helpful | Not Helpful
Also listed in
folder VPS

Prev   Next
Clear Memory Cache on Linux Server     How To create a local mirror of latest Red Hat Enterprise Linux...

RSS