LinuxCommandLibrary

lychee

Check links for broken URLs

TLDR

Scan a website for broken links

$ lychee [https://example.com]
copy

Display a breakdown of error types
$ lychee --format detailed [https://example.com]
copy

Limit the amount of connections to prevent DDOS protection
$ lychee --max-concurrency [5] [links.txt]
copy

Check files in a directory structure for any broken URLs
$ grep [[-r|--recursive]] "[pattern]" | lychee -
copy

Display help
$ lychee --help
copy

SYNOPSIS

lychee [OPTIONS] [INPUT_FILE...]

PARAMETERS

--accept
    Accept only certain status codes (comma-separated list)

--base
    Base URL to use for relative URLs

--cache
    Cache responses to disk

--config
    Path to the configuration file

--debug
    Enable debug output

--exclude
    Exclude URL(s) from checking (comma-separated list)

--file
    Read URLs from the given file

--format
    Output format (default: pretty, options: pretty, json, markdown, text, compact)

--include-all
    Include all links, even those excluded by default

--max-concurrency
    Maximum number of concurrent connections

--offline
    Do not send any network requests; only check links against a list of known good links

--output
    Write output to the given file

--pretty
    Enable colored output (default: true)

--retry
    Maximum number of retries per request

--timeout
    Timeout for each request in seconds

--verbose
    Enable verbose output

--version
    Show application version

DESCRIPTION

lychee is a fast, accurate, and feature-rich link checker written in Rust. It helps you maintain the quality of your websites, documentation, and other online content by identifying broken links, mail addresses, and other common issues. It supports a variety of input formats, including HTML, Markdown, text files, and sitemaps, and can be integrated into your CI/CD pipeline to automate link checking. Lychee supports configurable request headers, timeouts, and retries.

It is designed to be easy to use and integrates into existing workflows. By default, lychee reads links from standard input or from a file. The output can be customized to show only broken links, or to include more detailed information about each link.

CONFIGURATION FILES

Lychee can be configured using a YAML file. The configuration file allows you to specify various options, such as the timeout, retry count, and custom headers.

See the lychee documentation for more information on the configuration file format.

EXIT CODES

Lychee returns the following exit codes:

0: All links are valid.
1: Some links are broken.
2: An error occurred during execution.

SEE ALSO

curl(1), wget(1)

Copied to clipboard