curl Command in Linux
cURL, which stands for client URL, is a command line tool that developers use to transfer data to and from a server. Curl deals with a bunch of Internet Protocols like HTTP, FTP, SMTP, TELNET, SCP, LDAP and so on.
version
curl -V
-V Displays information about curl and the libcurl version it uses.
Verbose mode
During the operation, make curl verbose. Understanding the debugging process and what’s going on behind the scenes. A line starting with ‘>’ means header data sent by curl, ‘<’ means header data received by curl that is hidden in normal cases.
curl -v https://hacking-capture.github.io
Content of Website
Curl sends HTTP requests using the GET method by default.
curl https://hacking-capture.github.io
HTTP Response Headers
curl -I https://hacking-capture.github.io
-I returns only the HTTPS response headers.
Download File
curl -o file.pdf https://file-examples-com.github.io/uploads/2017/10/file-sample_150kB.pdf
Create Custom Headers
This option can be used multiple times to add/replace/remove multiple headers. Extra header to include in the request when sending HTTP to a server.Using the -H option, existing headers can be modified or add custom named headers.
HTTP requests include information about the user agent. Specify the User-Agent string to send to the HTTP server. For example user-agent change to ‘dummy-name’.
curl -H "User-Agent: dummy-name" https://hacking-capture.github.io
Send the custom header with no-value then its header must be terminated with a semicolon, such as -H “X-Custom-Header;” to send “X-Custom-Header:”. Most of these cases are used when testing websites.
Curl -H “X-Custom-Header;” https://hacking-capture.github.io
curl -H “X-Custom-Header:” https://hacking-capture.github.io