Skip to content

curl

curl is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP). The command is designed to work without user interaction.

curl offers a busload of useful tricks like proxy support, user authentication, FTP upload, HTTP post, SSL connections, cookies, file transfer resume, Metalink, and more.

Basic usage

HTTP/HTTPS: Display content of an URL

curl http://www.example.com/

SMB/SMBS: curl and SAMBA.

TODOC

curl -T file.txt -u "domain\username:passwd" smb://server.example.com/share/

Some extended usages

Make an HTTP request to a machine but fake the hostname

curl --resolve www.example.com:80:127.0.0.1 http://www.example.com/

Verify some strange thinks you can find in your webserver logs

curl -k --resolve _-_-:443:192.168.1.91 https://_-_-
Parameters Description
--resolve «host:port:address» Provide a custom address for a specific host and port pair. Using this, you can make the curl requests(s) use a specified address and prevent the otherwise normally resolved address to be used. Consider it a sort of /etc/hosts alternative provided on the command line. The port number should be the number used for the specific protocol the host will be used for. It means you need several entries if you want to provide address for the same host but different ports.
-k, --insecure (TLS) By default, every SSL connection curl makes is verified to be secure. This option allows curl to proceed and operate even for server connections otherwise considered insecure.
-T, --upload-file FILE This transfers the specified local file to the remote URL. If there is no file part in the specified URL, curl will append the local file name. NOTE that you must use a trailing / on the last directory to really prove to Curl that there is no file name or curl will think that your last directory name is the remote file name to use. That will most likely cause the upload operation to fail. If this is used on an HTTP(S) server, the PUT command will be used.