Quantcast
Channel: How can I find broken symlinks - Unix & Linux Stack Exchange
Browsing latest articles
Browse All 14 View Live
↧

Answer by murlakatamenka for How can I find broken symlinks

For zsh users: rm -v **/*(-@) from zsh user guide (search for broken symlinks)

View Article


Answer by trinth for How can I find broken symlinks

Simple no-brainer answer, which is a variation on OP's version. Sometimes, you just want something easy to type or remember: find . | xargs file | grep -i "broken symbolic link"

View Article


Answer by Iskren for How can I find broken symlinks

I use this for my case and it works quite well, as I know the directory to look for broken symlinks: find -L $path -maxdepth 1 -type l and my folder does include a link to /usr/share but it doesn't...

View Article

Answer by conradkdotcom for How can I find broken symlinks

This will print out the names of broken symlinks in the current directory. for l in $(find . -type l); do cd $(dirname $l); if [ ! -e "$(readlink $(basename $l))" ]; then echo $l; fi; cd - >...

View Article

Answer by Alex for How can I find broken symlinks

find -L . -type l |xargs symlinks will give you info whether the link exists or not on a per foundfile basis.

View Article


Answer by andy for How can I find broken symlinks

If you need a different behavior whether the link is broken or cyclic you can also use %Y with find: $ touch a $ ln -s a b # link to existing target $ ln -s c d # link to non-existing target $ ln -s e...

View Article

Answer by pooryorick for How can I find broken symlinks

As rozcietrzewiacz has already commented, find -L can have unexpected consequence of expanding the search into symlinked directories, so isn't the optimal approach. What no one has mentioned yet is...

View Article

Answer by rozcietrzewiacz for How can I find broken symlinks

I'd strongly suggest not to use find -L for the task (see below for explanation). Here are some other ways to do this: If you want to use a "pure find" method, it should rather look like this: find ....

View Article


Answer by Sam Morris for How can I find broken symlinks

The symlinks command from http://www.ibiblio.org/pub/Linux/utils/file/symlinks-1.4.tar.gz can be used to identify symlinks with a variety of characteristics. For instance: $ rm a $ ln -s a b $ symlinks...

View Article


Answer by kwarrick for How can I find broken symlinks

I believe adding the -L flag to your command will allow you do get rid of the grep: $ find -L . -type l http://www.commandlinefu.com/commands/view/8260/find-broken-symlinks from the man: -L Cause the...

View Article

How can I find broken symlinks

Is there a way to find all symbolic links that don't point anywere? find ./ -type l will give me all symbolic links, but makes no distinction between links that go somewhere and links that don't. I'm...

View Article

Answer by ArturZ for How can I find broken symlinks

find . -xtype l will skip broken links pointing to files in inaccessible directories. You can just search for links to inaccessible files:find . -type l ! -readableThis works correctly for cyclic...

View Article

Answer by liz for How can I find broken symlinks

I tookfind ./ -type l -exec file {} \; | that.awkand piped it into an Awk script, that way you can do whatever.#!/bin/awk -f#...

View Article


Answer by Nikita Zlobin for How can I find broken symlinks

Most comprehensive (imho) command to find broken symlinks without crossing partition bounds. Note, that symlink arguments must be containing directories, not symlinks themselves.find . -xdev -type d \|...

View Article
Browsing latest articles
Browse All 14 View Live