wcurl
Interact with WebDAV servers
TLDR
Download the contents of a URL to a file indicated by the URL ("foo" in this case)
Download the contents of a URL to a file with a specified name
Download the contents of a URL, enabling progress bar and defaulting to HTTP/2
Resume from an interrupted download
SYNOPSIS
wcurl [CURL_OPTIONS] URL
Note: `wcurl` is commonly an alias for `curl -w "..."` or a script that wraps `curl`.
PARAMETERS
%{url_effective}
The URL that was effectively used for the request, especially after redirects.
%{http_code}
The numerical HTTP status code that was returned for the request.
%{time_total}
The total time, in seconds, that the full operation lasted, including all stages.
%{time_namelookup}
Time in seconds from start till name lookup was completed.
%{time_connect}
Time in seconds from start till TCP connection to the remote host (or proxy) was completed.
%{time_starttransfer}
Time in seconds from start till the first byte of the response was received.
%{speed_download}
The average download speed in bytes per second for the transfer.
%{size_download}
The total number of bytes downloaded from the remote host.
%{num_connects}
Number of new successful connections made during the transfer.
%{errormsg}
The error message if an error occurred during the transfer.
%{content_type}
The Content-Type of the downloaded document as reported by the server.
%{remote_ip}
The remote IP address of the connected host.
%{redirect_url}
The URL a redirect points to, if a redirect occurred.
%{local_ip}
The local IP address of the interface used for the connection.
%{local_port}
The local port number used for the connection.
%{json}
All available variables formatted as a JSON string (requires `curl` 7.80.0 or later).
DESCRIPTION
wcurl is not a standard Linux command but typically an alias or shell script wrapping the powerful `curl` command. Its primary purpose is to simplify and standardize the use of `curl`'s `--write-out` (or `-w`) option, which allows users to define custom output formats for request information. Instead of repeatedly typing long `curl -w` format strings, wcurl might pre-define this or make it easier to access, for example, by defaulting to a useful set of metrics or allowing simple arguments to select predefined formats. This command is invaluable for scripting, automation, and debugging HTTP requests, providing precise control over the displayed metrics like response times, HTTP status, and redirect URLs. It leverages `curl`'s extensive capabilities to fetch data, but enhances the presentation of metadata about the request and response itself.
CAVEATS
wcurl is not a standard, standalone command distributed with typical Linux distributions. It is nearly always a user-defined shell alias or a custom script that wraps the `curl` command. Its exact behavior, available options, and default output format depend entirely on how it's defined on a specific system. Consequently, its presence, functionality, and output are not guaranteed across different environments or user setups. Users should check their shell configuration (`~/.bashrc`, `~/.zshrc`, etc.) or script locations to understand its precise implementation.
HOW IT WORKS
wcurl typically functions by pre-setting `curl`'s `--write-out` (`-w`) option. For example, a simple alias might be `alias wcurl='curl -w "%{{http_code}} %{{time_total}}s %{{url_effective}}\n"'`. When you run `wcurl example.com`, the shell expands this to `curl -w "%{{http_code}} %{{time_total}}s %{{url_effective}}\n" example.com`. More sophisticated wcurl scripts might parse additional arguments to dynamically construct the `--write-out` string or provide other conveniences, potentially adding their own specific options not native to `curl` itself.
COMMON USE CASES
wcurl is particularly useful for:
- Performance Monitoring: Quickly check total request time, DNS lookup time, and connection details for web services.
- API Testing: Easily extract HTTP status codes, effective URLs, or specific headers from responses for automated tests or debugging.
- Scripting: Integrate `curl` output directly into shell scripts in a predictable, parseable format, facilitating data extraction and conditional logic.
- Debugging: Gain immediate insight into redirect chains, connection details, and error messages without sifting through verbose output.
HISTORY
wcurl does not have a formal development history like standard Linux commands. Instead, its origin lies in the widespread user practice of creating convenience wrappers around powerful but verbose commands like `curl`. The `--write-out` (`-w`) option of `curl` was introduced early in its development (around `curl` 7.15.0 in 2006) to allow custom output formatting. Users, frequently needing specific metrics (like total time or HTTP status) for scripting or debugging, naturally created aliases or simple scripts (e.g., `alias wcurl='curl -w "%{{http_code}} %{{time_total}}s\n"'`) to avoid repeatedly typing long format strings. This pattern of creating wcurl has since become a common community practice, reflecting a need for more concise and consistent formatted `curl` output.