curl - submit HTTP requests and download files
curl command
curl
is a super popular command line tool for downloading files over the network via various network protocols like HTTP or FTP. It also supports submitting GET/POST requests via HTTP, making it very useful for API development and debugging.
curl is based on a libcurl
library, part of the same project, which makes it more suitable for use in programming various applications.
Check TCP Port Connectivity with curl
Here’s a quick video from UnixTutorial.TV showing how you can test TCP ports with curl
Test if Webpage Exists
Simply specify a URL and curl command will attempt a download:
In this example, we’re using the -o
(output) option to redirect output (page contents) into /dev/null
- we basically discard the contents as we’re not interested in it just yet.
Download File or Webpage into a File
In this example, we’re using the same -o
option but specify a filename instead of /dev/null
- thus making curl command save the URL content into a file named /tmp/webpage.html
:
If we check now, /tmp/webpage.html
file exists and contains whatever my main webpage did at the time of the download:
See also
curl command
curl
is a super popular command line tool for downloading files over the network via various network protocols like HTTP or FTP. It also supports submitting GET/POST requests via HTTP, making it very useful for API development and debugging.
curl is based on a libcurl
library, part of the same project, which makes it more suitable for use in programming various applications.
Check TCP Port Connectivity with curl
Here’s a quick video from UnixTutorial.TV showing how you can test TCP ports with curl
Test if Webpage Exists
Simply specify a URL and curl command will attempt a download:
In this example, we’re using the -o
(output) option to redirect output (page contents) into /dev/null
- we basically discard the contents as we’re not interested in it just yet.
Download File or Webpage into a File
In this example, we’re using the same -o
option but specify a filename instead of /dev/null
- thus making curl command save the URL content into a file named /tmp/webpage.html
:
If we check now, /tmp/webpage.html
file exists and contains whatever my main webpage did at the time of the download: