Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-18-2005, 09:59 PM   #1
Registered: Apr 2005
Location: Guangzhou, China
Distribution: Slackware 10.2
Posts: 114

Rep: Reputation: 15
How to delete the dead links

I have many dead link files in /usr/bin and /usr/local/bin, how to delete them quickly?
Old 04-19-2005, 12:19 AM   #2
Bruce Hill
HCL Maintainer
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Gentoo (all servers at work are openSUSE)
Posts: 6,937

Rep: Reputation: 128Reputation: 128
rm <name_of_symlink>
Old 04-19-2005, 07:29 AM   #3
Registered: Aug 2003
Location: Melbourne Australia
Distribution: Fedora Core 4
Posts: 184

Rep: Reputation: 30
Use mc on the command line, use "insert" to highlight the ones that you want to delete & hit F8. The dead ones will be quite obvious because they will be red.
If you are to use rm then use the -f arg, this will delete the files without asking you for conformation on every one, use carefully! See man rm for details.
Old 04-19-2005, 07:32 AM   #4
Registered: Aug 2003
Location: Melbourne Australia
Distribution: Fedora Core 4
Posts: 184

Rep: Reputation: 30
You could write a small script to do this but I don't have time to go into it now, sorry, besides, that would be a very good project for a newbie to start you off in the rewarding world of bash scripting!!
Old 04-19-2005, 06:45 PM   #5
Not now, John!
Registered: Jul 2004
Distribution: LFS 5.1
Posts: 161

Rep: Reputation: 30
find / -type l | xargs file | grep "broken" will give you a list of all broken symlinks.
Old 04-19-2005, 08:39 PM   #6
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
There is a utility called symlinks. It can peruse your file system and report the dangling links (links which don't point to any file), and, if you so desire, remove them for you.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bookmark mgr to remove dead links? hyllplan Linux - Software 0 08-31-2005 06:35 AM
links (hard links and soft links..) sachitha Programming 1 08-10-2005 12:10 PM
Squid:2nd Browser access Internet SPEED dead becomes dead slow mwj Linux - Software 1 10-04-2003 01:40 PM
Dead sym links Hangdog42 Linux - General 5 10-02-2003 04:35 AM
dead sym links dewcansam Linux - General 1 02-08-2002 04:49 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:53 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration