Linux Commands | Network | curl Web Access

curl Command

The cURL (Client URL) command is a command-line data transfer tool. It is free and open source, and it supports many protocols.

Support for Various Protocols

DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, Telnet, TFTP

Usage

curl (options...) [URL]

Options:

  • -X: Selects the HTTP method to use.
  • -d, --data: Specifies the request body.
  • -d (file_name): Sends the contents of a text file.
  • --data-urlencode: Uses URL encoding.
  • --data-binary: Used to send binary data.
  • -G: Site URL or IP address to send to.
  • -H: Sends header information.
  • -i: Retrieves only the site’s header information.
  • -I: Retrieves both the site’s header and body information.
  • -u: Displays user information.
  • -v: Displays detailed information.

curl Command Examples

Specify Only a URL

$ curl www.devkuma.com

Specify a Header Value

$ curl -H "Content-Type: application/json" www.devkuma.com

Specify an HTTP Method

$ curl -X GET www.devkuma.com