How to find broken soft links in a directory?

How to find broken symbolic links in a directory which have many symbolic links?

Use this command to find broken soft links:

find -xtype l /path/to/dir/to/find/in/

You can also specify the action by -exec. For example, delete the soft links that are broken in the current directory:

find -xtype l -exec rm -f {} ;

Not /path/to/dir/to/find/in/ specified here, which means . (the current directory).

Similar Posts

  • Why I cannot login remote server with its root

    Why You Can’t Login to a Remote Server as Root (and How to Fix It) If you’ve tried ssh root@my-server and got a “Permission denied” error, it’s not a bug—it’s a security feature. The Reason: PermitRootLogin In the /etc/ssh/sshd_config file, the line PermitRootLogin is set to prohibit-password or no by default on almost all modern…

  • Fedora 中文字体设置

    Fedora 一直有中文字体难看的问题, 尤其是在英文环境中. 使用本文中的配置方法可以得到令人满意的中文效果. 此方案中使用字体都为开源且在Fedora源中自带. 此方案对 Fedora 41 – 20 有效. 对于后续版本支持我会确认并更新此文章. 此方案对Gnome, KDE都有效. Firefox 中也有中文难看的问题, 后面会提到. 快速配置方法 如果你想马上配置好,请使用如下命令。此方法测试使用效果良好。 # yum install cjkuni-ukai-fonts cjkuni-uming-fonts # wget https://raw.githubusercontent.com/zma/config_files/master/others/local.conf \ -O /etc/fonts/local.conf 相关英文字体配置可以参考:Improving Fedora Font Rendering with Open Software and Fonts Only. Fedora 系统中文字体的配置方案 使用uming和ukai字体,即AR PL UMing CN等. 中文字体和等宽字体效果如图所示(点击看大图, Firefox 中文字体设置在后面会提到). 方法如下: 安装字体 首先安装这两个字体: cjkuni-ukai-fonts cjkuni-uming-fonts (在Fedora…

  • How to redirect HTTP to HTTPS in Apache with mod_rewrite?

    I’d like to force using of https on one of my site. How to redirect HTTP to HTTPS in Apache with mod_rewrite? You can put these lines to the .htaccess file in the directory from which you would like to redirect HTTPS to HTTP: RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} Read more: How…

Leave a Reply

Your email address will not be published. Required fields are marked *