Link Checker
Check URLs for HTTP status codes, find broken links in documents, and track link health over time. Feed it a single URL, a file full of links, or a batch of addresses — it hits each one with curl, records the status code, and tells you what's alive and what's dead. Results are stored in ~/.link-checker/ so you can review history, pull stats, and export reports.
Commands
check
Check a single URL. Sends an HTTP HEAD request and returns the status code.
CODEBLOCK0
Output includes status code, a human-readable label (OK, REDIRECT, CLIENT_ERROR, etc.), and an icon.
scan
Extract all URLs from a file (markdown, HTML, plain text — anything with http:// or https:// links) and check each one.
CODEBLOCK1
Uses grep to pull URLs, deduplicates them, then checks each. Prints a summary at the end with pass/fail counts.
batch
Check multiple URLs in one go. Pass them as arguments.
CODEBLOCK2
report
Generate a report from the current session's results. Supports three formats.
CODEBLOCK3
Default format is txt. Reports are saved to ~/.link-checker/report.<format>.
history
Display the last 50 check results from the history log.
CODEBLOCK4
Shows timestamp, status code, status label, and URL for each entry.
broken
Filter results to show only failed links — status codes 4xx, 5xx, timeouts, and connection errors.
CODEBLOCK5
stats
Show statistics across all checks: total count, breakdown by status category (2xx, 3xx, 4xx, 5xx, timeout, error), success rate percentage, and the most common status codes.
CODEBLOCK6
export
Export the full history log to a file. Supports csv, json, and txt.
CODEBLOCK7
Exported files are timestamped and saved to ~/.link-checker/.
config
View current configuration or change settings.
CODEBLOCK8
Available keys: timeout (seconds per request), retries (retry count on failure), user_agent.
help
Show usage information and available commands.
CODEBLOCK9
version
Print the current version.
CODEBLOCK10
Examples
CODEBLOCK11
Configuration
Settings are stored in ~/.link-checker/config as key-value pairs.
| Key | Default | Description |
|---|
| INLINECODE26 | INLINECODE27 | Connection timeout in seconds per request |
| INLINECODE28 |
2 | Number of retry attempts on timeout/error |
|
user_agent |
LinkChecker/1.0.0 | User-Agent header sent with requests |
Change any setting with link-checker config set <key> <value>.
Data Storage
All data lives in ~/.link-checker/:
| File | Purpose |
|---|
| INLINECODE34 | Current session results (pipe-delimited) |
| INLINECODE35 |
Cumulative log of all checks ever run |
|
config | Configuration key-value file |
|
report.* | Generated reports (txt/csv/json) |
|
export_*.* | Timestamped exports |
Log format: INLINECODE39
Status Categories
Redirect | 3xx |
| ❌ | Client Error | 4xx |
| ⚠️ | Server Error | 5xx |
| ⏱️ | Timeout | Connection timed out |
| 🚫 | Error | DNS failure, connection refused |
Requirements
- -
bash (4.0+) - INLINECODE41
- INLINECODE42 ,
sort, awk (standard Unix tools)
Powered by BytesAgain | bytesagain.com | hello@bytesagain.com
链接检查器
检查URL的HTTP状态码,查找文档中的失效链接,并随时间追踪链接健康状态。输入单个URL、包含多个链接的文件或一批地址——它会用curl逐个访问,记录状态码,并告诉你哪些链接有效、哪些已失效。结果存储在~/.link-checker/中,方便你查看历史记录、提取统计数据和导出报告。
命令
check
检查单个URL。发送HTTP HEAD请求并返回状态码。
link-checker check
输出包括状态码、可读标签(OK、REDIRECT、CLIENT_ERROR等)以及图标。
scan
从文件中提取所有URL(markdown、HTML、纯文本——任何包含http://或https://链接的文件)并逐个检查。
link-checker scan
使用grep提取URL,去重后逐个检查。最后输出包含通过/失败计数的摘要。
batch
一次性检查多个URL。将它们作为参数传入。
link-checker batch ...
report
从当前会话的结果生成报告。支持三种格式。
link-checker report [txt|csv|json]
默认格式为txt。报告保存至~/.link-checker/report.。
history
显示历史日志中最近50条检查结果。
link-checker history
显示每条记录的时间戳、状态码、状态标签和URL。
broken
筛选结果,仅显示失败的链接——状态码4xx、5xx、超时和连接错误。
link-checker broken
stats
显示所有检查的统计数据:总次数、按状态类别(2xx、3xx、4xx、5xx、超时、错误)的分布、成功率百分比以及最常见状态码。
link-checker stats
export
将完整历史日志导出到文件。支持csv、json和txt格式。
link-checker export
导出的文件带有时间戳,保存至~/.link-checker/。
config
查看当前配置或更改设置。
link-checker config
link-checker config set
可用键:timeout(每次请求的超时秒数)、retries(失败时的重试次数)、user_agent。
help
显示使用信息和可用命令。
link-checker help
version
打印当前版本。
link-checker version
示例
bash
检查URL是否可达
link-checker check https://example.com
扫描markdown文件中的失效链接
link-checker scan ./README.md
批量检查多个URL
link-checker batch https://example.com https://httpstat.us/404 https://httpstat.us/500
仅查看失效链接
link-checker broken
获取统计概览
link-checker stats
生成JSON格式报告
link-checker report json
导出完整历史记录为CSV
link-checker export csv
设置请求超时为15秒
link-checker config set timeout 15
设置重试次数为3
link-checker config set retries 3
配置
设置以键值对形式存储在~/.link-checker/config中。
| 键 | 默认值 | 描述 |
|---|
| timeout | 10 | 每次请求的连接超时秒数 |
| retries |
2 | 超时/错误时的重试次数 |
| user_agent | LinkChecker/1.0.0 | 请求时发送的User-Agent头 |
使用link-checker config set 更改任何设置。
数据存储
所有数据存储在~/.link-checker/中:
| 文件 | 用途 |
|---|
| results.log | 当前会话结果(管道符分隔) |
| history.log |
所有已运行检查的累积日志 |
| config | 配置键值文件 |
| report.* | 生成的报告(txt/csv/json) |
| export_
. | 带时间戳的导出文件 |
日志格式:timestamp|url|statuscode|statuslabel
状态类别
重定向 | 3xx |
| ❌ | 客户端错误 | 4xx |
| ⚠️ | 服务器错误 | 5xx |
| ⏱️ | 超时 | 连接超时 |
| 🚫 | 错误 | DNS失败、连接被拒绝 |
系统要求
- - bash(4.0+)
- curl
- grep、sort、awk(标准Unix工具)
由BytesAgain提供技术支持 | bytesagain.com | hello@bytesagain.com