LinuxCommandLibrary

lwp-request

command-line HTTP client from the LWP suite

TLDR

GET request

$ lwp-request [https://example.com/]
copy
POST request with data
$ lwp-request -m POST -c 'application/json' -C '[{"key":"value"}]' [https://api.example.com/]
copy
HEAD request (headers only)
$ lwp-request -m HEAD [https://example.com/]
copy
Show response headers and content
$ lwp-request -USed [https://example.com/]
copy
Follow redirects
$ lwp-request -f [https://example.com/redirect]
copy
Use specific method
$ lwp-request -m [DELETE] [https://api.example.com/resource]
copy
Set custom header
$ lwp-request -H 'Authorization: Bearer [token]' [https://api.example.com/]
copy
Save to file
$ lwp-request [https://example.com/file] > [output]
copy

SYNOPSIS

lwp-request [-m method] [-f] [-H header] [-c content-type] [-C content] [options] url

DESCRIPTION

lwp-request is a command-line HTTP client from the LWP (Library for WWW in Perl) suite. It sends HTTP requests and displays responses.
The tool is also available as GET, POST, and HEAD commands, which are symlinks with preset methods. These shortcuts simplify common operations.
Output options control what gets printed: request details (-U, -S, -d) and response details (-e, -s). Combined flags show the full transaction for debugging.
Authentication, cookies, and proxy settings come from environment variables or configuration files. It integrates with the Perl LWP ecosystem.
For simple testing and scripting, lwp-request provides HTTP access without additional dependencies beyond Perl's LWP modules.

PARAMETERS

-m METHOD

HTTP method (GET, POST, HEAD, PUT, DELETE).
-f
Follow redirects.
-H HEADER
Add custom header.
-c TYPE
Content-Type for request body.
-C CONTENT
Content/body data.
-b URI
Base URI for relative URLs.
-o FORMAT
Output format.
-d
Print request content/body.
-e
Print response headers.
-s
Print response status.
-S
Print request URL.
-U
Print request headers.
-t SECONDS
Timeout.
-a
Use text mode for content.

CAVEATS

Requires libwww-perl package. Less feature-rich than curl or httpie. Error handling is basic. Large file downloads may be slow.

HISTORY

lwp-request is part of libwww-perl, created by Gisle Aas starting in the 1990s. LWP became the standard HTTP library for Perl, and lwp-request provided command-line access to its functionality.

SEE ALSO

curl(1), wget(1), http(1), perl(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community