CHECKLINK(1p)

๐Ÿ“ฆ
version 5.0.0 ยท 4 versions
, in ubuntu noble, ubuntu questing

okay so real quick, the manual name up top is checklink, it lives in the User Contributed Perl Documentation corner of the man pages, and yes bestie, it's giving 1p energy. let's get into it ๐Ÿฆ‹


โœจ NAME โœจ

checklink โ€” check the validity of links in an HTML or XHTML document ๐Ÿ”—โœจ


๐ŸŒธ SYNOPSIS ๐ŸŒธ

checklink  [ options ] uri ...

that's it. that's the whole vibe. you give it options and one or more URIs. slay. ๐Ÿ’…


๐ŸŽ€ DESCRIPTION ๐ŸŽ€

okay so first of all, this manual page is just the lil quick-and-dirty overview of the checklink command, aka the W3Cยฎ Link Checker. icon behavior, no notes. ๐Ÿ‘‘

so what does it actually do, you ask? it reads an HTML or XHTML document, extracts a whole list of anchors and links, and then:

  • checks that no anchor is defined twice ๐Ÿ™ˆ
  • checks that all the links are dereferenceable, and yes that includes the fragments (iykyk)
  • warns you about HTTP redirects, including directory redirects, because redirects are messy and it's not here to be quiet about them
  • can check recursively a part of a web site, which is either incredibly useful or a great way to lose an afternoon, depending ๐ŸŒ€

and the way that it can be used either as a command line tool or as a CGI script?? versatile. multi-talented. main character energy fr fr. โœจ


๐Ÿซถ OPTIONS ๐Ÿซถ

this program follows the usual GNU command line syntax, with long options starting with two dashes (-). a summary of options is included below, and bestie I am not skipping a single one, we're doing all of them ๐Ÿ’…

  • -?, -h, --help โ€” show summary of options. the "wait what does this do again" button ๐Ÿฅบ
  • -V, --version โ€” output version information. ๐Ÿท๏ธ
  • -s, --summary โ€” show result summary only. just the highlights, no yapping โœจ
  • -b, --broken โ€” show only the broken links, not the redirects. ๐Ÿ’€ only the casualties, bestie
  • -e, --dir-redirects โ€” hide directory redirects โ€” e.g. <http://www.w3.org/TR> -> <http://www.w3.org/TR/>. ๐Ÿ™ˆ those lil slashes, honestly
  • -r, --recursive โ€” check the documents linked from the first one. it goes deeper ๐ŸŒ€
  • -D, --depth n โ€” check the documents linked from the first one to depth n (implies --recursive). how deep are we going bestie ๐ŸŒŠ
  • -l, --location uri โ€” scope of the documents checked (implies --recursive). can be specified multiple times in order to specify multiple recursion bases. if the URI of a candidate document is downwards relative to any of the bases, it is considered to be within the scope. if not specified, the default is the base URI of the initial document โ€” for example, for <http://www.w3.org/TR/html4/Overview.html> it would be <http://www.w3.org/TR/html4/>. ๐Ÿ—บ๏ธ knowing your boundaries is self care
  • -X, --exclude regexp โ€” do not check links whose full, canonical URIs match regexp. โš ๏ธ note that this option limits recursion the same way as --exclude-docs with the same regular expression would. โœ‚๏ธ
  • --exclude-docs regexp โ€” in recursive mode, do not check links in documents whose full, canonical URIs match regexp. this option may be specified multiple times. ๐Ÿšซ๐Ÿ“„
  • --suppress-redirect URI->URI โ€” do not report a redirect from the first to the second URI. the "->" is literal text. this option may be specified multiple times. whitespace may be used instead of "->" to separate the URIs. ๐Ÿคซ
  • --suppress-redirect-prefix URI->URI โ€” do not report a redirect from a child of the first URI to the same child of the second URI. the "->" is literal text. this option may be specified multiple times. whitespace may be used instead of "->" to separate the URIs. ๐Ÿค
  • --suppress-temp-redirects โ€” do not report warnings about temporary redirects. it's just passing through, let it live ๐ŸŒฌ๏ธ
  • --suppress-broken CODE:URI โ€” do not report a broken link with the given CODE. CODE is the HTTP response, or -1 for robots exclusion. the ":" is literal text. this option may be specified multiple times. whitespace may be used instead of ":" to separate the CODE and the URI. ๐Ÿฉน
  • --suppress-fragment URI โ€” do not report the given broken fragment URI. a fragment URI contains "#". this option may be specified multiple times. ๐Ÿงฉ
  • -L, --languages accept-language โ€” the "Accept-Language" HTTP header to send. in command line mode, this header is not sent by default. the special value "auto" causes a value to be detected from the "LANG" environment variable, and sent if found. in CGI mode, the default is to send the value received from the client as is. ๐ŸŒ๐Ÿ—ฃ๏ธ
  • -c, --cookies cookie-file โ€” use cookies, load/save them in cookie-file. the special value "tmp" causes non-persistent use of cookies, i.e. they are used but only stored in memory for the duration of this link checker run. ๐Ÿช iconic
  • -R, --no-referer โ€” do not send the "Referer" HTTP header. ๐Ÿ•ต๏ธโ™€๏ธ
  • -q, --quiet โ€” no output if no errors are found. implies --summary. ๐Ÿคซโœจ
  • -v, --verbose โ€” verbose mode. tell me EVERYTHING ๐Ÿ—ฃ๏ธ
  • -i, --indicator โ€” show progress while parsing as percentage of lines processed. no indicator is shown for documents containing no linefeeds. ๐Ÿ“Š
  • -u, --user username โ€” specify a username for authentication. ๐Ÿชช
  • -p, --password password โ€” specify a password for authentication. ๐Ÿ”
  • --hide-same-realm โ€” hide 401's that are in the same realm as the document checked. ๐Ÿ™ˆ
  • -S, --sleep secs โ€” sleep the specified number of seconds between requests to each server. defaults to 1 second, which is also the minimum allowed. ๐Ÿ˜ด be polite to servers bestie
  • -t, --timeout secs โ€” timeout for requests, in seconds. the default is 30. โฑ๏ธ
  • -C, --connection-cache number โ€” maximum number of cached connections. using this option overrides the "Connection_Cache_Size" configuration file parameter โ€” see its documentation below for the default value and more information. ๐Ÿ—„๏ธ
  • -d, --domain domain โ€” Perl regular expression describing the domain to which the authentication information (if present) will be sent. the default value can be specified in the configuration file. see the "Trusted" entry in the configuration file description below for more information. ๐Ÿฐ
  • --masquerade "real-prefix surrogate-prefix" โ€” perform a simple string substitution: URIs which begin with the string "real-prefix" are rewritten using the "surrogate-prefix" before being dereferenced. useful for making a local directory masquerade as a remote one. for example:
--masquerade "http://example.com/x/y/z/ file:///my/local/dir/"

if the document being checked contains a link to http://example.com/x/y/z/foo.html, then the local file system will be checked for file:///my/local/dir/foo.html.

--masquerade takes a single argument consisting of two URIs, separated by whitespace. the quote marks are not part of the argument, but one usual way of providing a value with embedded whitespace is to enclose it in quotes. ๐ŸŽญ

  • -H, --html โ€” HTML output. ๐ŸŒ

๐Ÿงš FILES ๐Ÿงš

  • /etc/w3c/checklink.conf โ€” the main configuration file. you can use the W3C_CHECKLINK_CFG environment variable to override the default location. ๐Ÿ“

"Trusted" specifies a regular expression for matching trusted domains (ie. domains where HTTP basic authentication, if any, will be sent). the regular expression will be matched case insensitively against host names. the default behavior (when unset, that is) is to send the authentication information only to the host which requests it; usually you don't want to change this. for example, the following configures only the w3.org domain as trusted:

Trusted = \.w3\.org$

"Allow_Private_IPs" is a boolean flag indicating whether checking links on non-public IP addresses is allowed. the default is true in command line mode and false when run as a CGI script. for example, to disallow checking non-public IP addresses, regardless of the mode, use:

Allow_Private_IPs = 0

"Forbidden_Protocols" is a comma separated list of additional protocols/URI schemes that the link checker is not allowed to use. the "javascript" and "mailto" schemes are always forbidden, and so is the "file" scheme when running as a CGI script.

Forbidden_Protocols = javascript,mailto

"Markup_Validator_URI" and "CSS_Validator_URI" are formatted URIs to the respective validators. the %s in these will be replaced with the full "URI encoded" URI to the document being checked, and shown in the link checker results view in the online/CGI version. the defaults are:

Markup_Validator_URI =
  http://validator.w3.org/check?uri=%s
CSS_Validator_URI =
  http://jigsaw.w3.org/css-validator/validator?uri=%s

"Doc_URI" is a URI used for linking to the documentation, and CSS and JavaScript files in the dynamically generated content of the link checker. the default is:

Doc_URI = http://validator.w3.org/docs/checklink.html

"Connection_Cache_Size" is an integer denoting the maximum number of connections the link checker will keep open at any given time. the default is:

Connection_Cache_Size = 2

๐ŸŒˆ ENVIRONMENT ๐ŸŒˆ

checklink uses the libwww-perl library, which has a number of environment variables affecting its behaviour. see "SEE ALSO" for some pointers. ๐Ÿ‘€

  • W3C_CHECKLINK_CFG โ€” if set, overrides the path to the configuration file. ๐Ÿ› ๏ธ

๐Ÿ’œ SEE ALSO ๐Ÿ’œ

the documentation for this program is available on the web at <http://validator.w3.org/docs/checklink.html>. ๐Ÿ”—

LWP, Net::FTP, Net::NNTP, Net::IP, perlre. ๐Ÿซถ


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

this program was originally written by Hugo Haas <hugo@w3.org>, based on Renaud Bruyeron's checklink.pl. it has been enhanced by Ville Skyttรค and many other volunteers since. use the <www-validator@w3.org> mailing list for feedback, and see <http://validator.w3.org/docs/checklink.html#csb> for more information. ๐Ÿ’Œ

this manual page was originally written by Frรฉdรฉric Schรผtz <schutz@mathgen.ch> for the Debian GNU/Linux system (but may be used by others). ๐Ÿง


this program is licensed under the W3Cยฎ Software License, <http://www.w3.org/Consortium/Legal/copyright-software>. ๐Ÿ“œ


and that's the whole page bestie!! this version came from perl v5.36.0 dated 2022-10-02, so if you're reading a different build, that's a different era okay?? go check some links, be nice to servers, and hydrate ๐Ÿ’–๐Ÿฆ‹๐ŸŒธโœจ

๐Ÿ“ฆ where this page comes from