DeadLink — Dead Link Checker
Check URLs for broken links. Scan individual URLs, files containing links, or crawl websites. Generates reports with HTTP status codes.
Commands
| Command | Description |
|---|
| INLINECODE0 | Check a single URL — shows HTTP status, redirect target if applicable |
| INLINECODE1 |
Extract and check all URLs found in a text file |
|
site <url> [depth] | Crawl a webpage, extract all href/src links, and check each one |
|
report <file> | Generate a timestamped report file from all URLs in a text file |
Examples
CODEBLOCK0
Status Codes
- - 2xx — OK (alive)
- 3xx — Redirect (alive, shows final URL)
- 4xx — Client error (dead — 404 Not Found, 403 Forbidden, etc.)
- 5xx — Server error (dead)
- 000 — Connection failed (DNS error, timeout, unreachable)
Requirements
- -
curl — must be installed and in PATH - Network access to check URLs
Notes
- - Timeout: 10 seconds per URL (5s connect timeout)
- URLs are extracted using regex pattern matching for
http:// and https:// links - The
site command does basic HTML link extraction (href and src attributes) - Reports are saved as plain text files in the current directory
DeadLink — 死链检查器
检查URL是否为死链。可扫描单个URL、包含链接的文件,或爬取网站。生成包含HTTP状态码的报告。
命令
| 命令 | 描述 |
|---|
| check <url> | 检查单个URL — 显示HTTP状态码,如有重定向则显示目标地址 |
| scan <file> |
提取并检查文本文件中所有URL |
| site
[depth] | 爬取网页,提取所有href/src链接并逐一检查 |
| report | 根据文本文件中的所有URL生成带时间戳的报告文件 |
示例
bash
检查单个URL
deadlink check https://example.com/page
→ 200 OK
扫描Markdown文件中的死链
deadlink scan README.md
→ 提取所有http/https URL并逐一检查
爬取网站
deadlink site https://example.com 1
→ 获取页面,提取所有链接,逐一检查
生成报告文件
deadlink report bookmarks.html
→ 创建 deadlink-report-20240101-120000.txt
状态码
- - 2xx — 正常(有效)
- 3xx — 重定向(有效,显示最终URL)
- 4xx — 客户端错误(死链 — 404未找到、403禁止访问等)
- 5xx — 服务器错误(死链)
- 000 — 连接失败(DNS错误、超时、无法访问)
系统要求
- - curl — 必须已安装并配置在PATH环境变量中
- 需要网络访问权限以检查URL
注意事项
- - 超时设置:每个URL 10秒(连接超时5秒)
- URL通过正则表达式匹配http://和https://链接进行提取
- site命令执行基本的HTML链接提取(href和src属性)
- 报告以纯文本文件形式保存在当前目录中