Using cURL in the Terminal for Mac OS X

Using cURL in the Terminal for Mac OS X

Syntax:curl [-Options] <URL>

Usagea:cURL is an inbuilt tool in Mac OS X which lets you transfer data from or to a server, using one of the many supported protocols (HTTP,HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP or FILE).

cURL can be used for alot of things, for example:

  • Fetch files from a remote server directly to your local computer.
  • Fetch the source code of a webpage.
  • Post new tweets on Twitter without logging in on their website.

Example

curl whatismyip.orgOutputs your IP address directly in the Terminal window
curl yourdomain.comDisplays the source code of yourdomain.com directly in the Terminal window.
curl http://www.yourdomain.com/backup/backup.zip -o /local/path/on/your/mac/backup.zipFetch a backup file created on your remote server.
Using cURL in the Terminal for Mac OS X

More information