Skip to content

CLI

Terminal window
lychee [OPTIONS] <inputs>...

<inputs>...

The inputs (where to get links to check from). These can be:

  • Files (e.g. README.md)
  • File globs (e.g. "~/git/*/README.md")
  • Remote URLs (e.g. https://example.com/README.md)
  • Standard input (-)

Configuration file to use.

Default: lychee.toml

Terminal window
lychee --config custom-config.toml

Set verbosity level; more output per occurrence (e.g. -v or -vv).

Terminal window
lychee -vv README.md

Less output per occurrence (e.g. -q or -qq).

Terminal window
lychee -qq README.md

Do not show progress bar. This is recommended for non-interactive shells (e.g. for continuous integration).

Terminal window
lychee --no-progress README.md

Print help information (use -h for a summary).

Print version information.

Test the specified file extensions for URIs when checking files locally.

Multiple extensions can be separated by commas. Note that if you want to check filetypes which have multiple extensions, e.g. HTML files with both .html and .htm extensions, you need to specify both extensions explicitly.

Default: md,mkd,mdx,mdown,mdwn,mkdn,mkdown,markdown,html,htm,txt

Terminal window
lychee --extensions md,html,txt

Skip missing input files (default is to error if they don’t exist).

Terminal window
lychee --skip-missing file1.md file2.md

Do not skip files that would otherwise be ignored by .gitignore, .ignore, or the global ignore file.

Terminal window
lychee --no-ignore .

Do not skip hidden directories and files.

Terminal window
lychee --hidden .

Ignore case when expanding filesystem path glob inputs.

Terminal window
lychee --glob-ignore-case "**/*.MD"

Don’t perform any link checking. Instead, dump all the links extracted from inputs that would be checked.

Terminal window
lychee --dump README.md

Don’t perform any link extraction and checking. Instead, dump all input sources from which links would be collected.

Terminal window
lychee --dump-inputs "docs/**/*.md"

Use request cache stored on disk at .lycheecache.

Terminal window
lychee --cache README.md

Discard all cached requests older than this duration.

Default: 1d

Terminal window
lychee --cache --max-cache-age 7d README.md

A list of status codes that will be ignored from the cache.

The following exclude range syntax is supported: [start]..[[=]end]|code

Valid examples:

  • 429 (excludes the 429 status code only)
  • 500.. (excludes any status code >= 500)
  • ..100 (excludes any status code < 100)
  • 500..=599 (excludes any status code from 500 to 599 inclusive)
  • 500..600 (excludes any status code from 500 to 600 excluding 600, same as 500..=599)
Terminal window
lychee --cache --cache-exclude-status '429, 500..502' README.md

Maximum number of allowed redirects.

Default: 5

Terminal window
lychee --max-redirects 10 README.md

Maximum number of retries per request.

Default: 3

Terminal window
lychee --max-retries 5 README.md

Minimum wait time in seconds between retries of failed requests.

Default: 1

Terminal window
lychee --retry-wait-time 5 README.md

Website timeout in seconds from connect to response finished.

Default: 20

Terminal window
lychee --timeout 30 README.md

Maximum number of concurrent network requests.

Default: 128

Terminal window
lychee --max-concurrency 64 README.md

Number of threads to utilize. Defaults to number of cores available to the system.

Terminal window
lychee --threads 4 README.md

User agent string to use for requests.

Default: lychee/0.20.1

Terminal window
lychee --user-agent "Mozilla/5.0" README.md

Proceed for server connections considered insecure (invalid TLS).

Terminal window
lychee --insecure README.md

Minimum accepted TLS Version.

Possible values: TLSv1_0, TLSv1_1, TLSv1_2, TLSv1_3

Terminal window
lychee --min-tls TLSv1_2 README.md

Request method to use.

Default: get

Terminal window
lychee --method head README.md

Only check local files and block network requests.

Terminal window
lychee --offline README.md

Set custom header for requests.

Some websites require custom headers to be passed in order to return valid responses. You can specify custom headers in the format 'Name: Value'. For example, 'Accept: text/html'. This is the same format that other tools like curl or wget use. Multiple headers can be specified by using the flag multiple times.

Terminal window
lychee --header "Accept: text/html" --header "Authorization: Bearer token" README.md

Basic authentication support.

Format: http://example.com username:password

Terminal window
lychee --basic-auth "http://example.com user:pass" README.md

GitHub API token to use when checking github.com links, to avoid rate limiting.

Environment variable: GITHUB_TOKEN

Terminal window
lychee --github-token ghp_xxxxxxxxxxxx README.md
# or
export GITHUB_TOKEN=ghp_xxxxxxxxxxxx
lychee README.md

Tell lychee to read cookies from the given file. Cookies will be stored in the cookie jar and sent with requests. New cookies will be stored in the cookie jar and existing cookies will be updated.

Terminal window
lychee --cookie-jar cookies.txt README.md

Only test links with the given schemes (e.g. https). Omit to check links with any other scheme.

Supported schemes: http, https, file, mailto

Terminal window
lychee --scheme https README.md
lychee --scheme http https file -- README.md

URLs to check (supports regex). Has preference over all excludes.

Terminal window
lychee --include "https://example.com.*" README.md

Exclude URLs and mail addresses from checking. The values are treated as regular expressions.

Terminal window
lychee --exclude "https://example.com" --exclude "mailto:.*" README.md

Exclude paths from getting checked. The values are treated as regular expressions.

Terminal window
lychee --exclude-path "node_modules" --exclude-path "vendor" .

Exclude all private IPs from checking. Equivalent to --exclude-private --exclude-link-local --exclude-loopback.

Terminal window
lychee --exclude-all-private README.md

Exclude private IP address ranges from checking.

Terminal window
lychee --exclude-private README.md

Exclude link-local IP address range from checking.

Terminal window
lychee --exclude-link-local README.md

Exclude loopback IP address range and localhost from checking.

Terminal window
lychee --exclude-loopback README.md

Also check email addresses.

Terminal window
lychee --include-mail README.md

Enable the checking of fragments in links (e.g., checking if #section exists on a page).

Terminal window
lychee --include-fragments README.md

Find links in verbatim sections like pre- and code blocks.

Terminal window
lychee --include-verbatim README.md

Check WikiLinks in Markdown files.

Terminal window
lychee --include-wikilinks README.md

A list of accepted status codes for valid links.

The following accept range syntax is supported: [start]..[[=]end]|code

Valid examples:

  • 200 (accepts the 200 status code only)
  • ..204 (accepts any status code < 204)
  • ..=204 (accepts any status code <= 204)
  • 200..=204 (accepts any status code from 200 to 204 inclusive)
  • 200..205 (accepts any status code from 200 to 205 excluding 205, same as 200..=204)

Default: 100..=103,200..=299

Terminal window
lychee --accept '200..=204, 429, 500' README.md

When HTTPS is available, treat HTTP links as errors.

Terminal window
lychee --require-https README.md

Base URL used to resolve relative URLs during link checking.

Terminal window
lychee --base-url https://example.com docs/

Root path to use when checking absolute local links. Must be an absolute path.

Terminal window
lychee --root-dir /home/user/project docs/

Remap URI matching pattern to different URI.

Terminal window
lychee --remap "https://old.example.com https://new.example.com" README.md

When checking locally, attempts to locate missing files by trying the given fallback extensions. Multiple extensions can be separated by commas. Extensions will be checked in order of appearance.

Terminal window
lychee --fallback-extensions html,htm,php,asp README.md

When checking locally, resolves directory links to a separate index file. The argument is a comma-separated list of index file names to search for. Index names are relative to the link’s directory and attempted in the order given.

If --index-files is specified, then at least one index file must exist in order for a directory link to be considered valid. Additionally, the special name . can be used in the list to refer to the directory itself.

If unspecified (the default behavior), index files are disabled and directory links are considered valid as long as the directory exists.

Examples:

Terminal window
# Looks for index.html or readme.md and requires that at least one exists
lychee --index-files index.html,readme.md docs/
# Will use index.html if it exists, but still accept the directory link regardless
lychee --index-files index.html,. docs/
# Will reject all directory links because there are no valid index files
lychee --index-files '' docs/

Specify the use of a specific web archive. Can be used in combination with --suggest.

Possible values: wayback

Terminal window
lychee --archive wayback --suggest README.md

Suggest link replacements for broken links, using a web archive. The web archive can be specified with --archive.

Terminal window
lychee --suggest README.md

Output file of status report.

Terminal window
lychee --output report.txt README.md

Output format of final status report.

Default: compact

Possible values: compact, detailed, json, markdown, raw

Terminal window
lychee --format json --output report.json README.md

Set the output display mode. Determines how results are presented in the terminal.

Default: color

Possible values: plain, color, emoji, task

Terminal window
lychee --mode emoji README.md

Options can be specified multiple times. This is true for:

  • --exclude
  • --exclude-path
  • --header
  • --include
  • --remap
  • --scheme

Here is an example:

Terminal window
lychee --exclude https://example.com --exclude https://example.org README.md

There is a shorthand where you can specify multiple arguments in one go.

Instead of writing this:

Terminal window
lychee --scheme http --scheme file https://example.com

You can also write this:

Terminal window
lychee --scheme http file -- https://example.com