2013-12-08 09:56:16 +01:00
|
|
|
# curl
|
|
|
|
|
2013-12-09 12:12:16 +01:00
|
|
|
> Transfers data from or to a server
|
|
|
|
> Supports most protocols including HTTP, FTP, POP
|
2013-12-08 09:56:16 +01:00
|
|
|
|
A bunch of new pages:
common/: dig, gzip, rm, sort, zfs, zpool
linux/: apt-get, shutdown
osx/: airport, caffeinate, diskutil, networksetup open, pgrep, qlmanage, say, shutdown, sysctl, system_profiler
Edits to existing pages:
curl: Added simple download example
find: Added iname and size exmaples
grep: Edited -c description
ps: Added wide lines example
ssh: edited -D description, added simple port forwarding example
unzip: added list option
2014-02-10 21:36:05 +01:00
|
|
|
- Download a URL to a file
|
|
|
|
|
2015-10-22 09:31:52 +02:00
|
|
|
`curl "{{URL}}" -o filename`
|
A bunch of new pages:
common/: dig, gzip, rm, sort, zfs, zpool
linux/: apt-get, shutdown
osx/: airport, caffeinate, diskutil, networksetup open, pgrep, qlmanage, say, shutdown, sysctl, system_profiler
Edits to existing pages:
curl: Added simple download example
find: Added iname and size exmaples
grep: Edited -c description
ps: Added wide lines example
ssh: edited -D description, added simple port forwarding example
unzip: added list option
2014-02-10 21:36:05 +01:00
|
|
|
|
2013-12-09 12:12:16 +01:00
|
|
|
- send form-encoded data
|
2013-12-08 09:56:16 +01:00
|
|
|
|
2013-12-09 12:12:16 +01:00
|
|
|
`curl --data {{name=bob}} {{http://localhost/form}}`
|
2013-12-08 09:56:16 +01:00
|
|
|
|
2013-12-09 12:12:16 +01:00
|
|
|
- send JSON data
|
2013-12-08 09:56:16 +01:00
|
|
|
|
2013-12-09 12:12:16 +01:00
|
|
|
`curl -X POST -H "Content-Type: application/json" -d {{'{"name":"bob"}'}} {{http://localhost/login}}`
|
2013-12-08 09:56:16 +01:00
|
|
|
|
2013-12-09 12:12:16 +01:00
|
|
|
- specify an HTTP method
|
2013-12-08 09:56:16 +01:00
|
|
|
|
2013-12-09 12:12:16 +01:00
|
|
|
`curl -X {{DELETE}} {{http://localhost/item/123}}`
|
2013-12-08 09:56:16 +01:00
|
|
|
|
2013-12-09 12:12:16 +01:00
|
|
|
- head request
|
2013-12-08 09:56:16 +01:00
|
|
|
|
2013-12-09 12:12:16 +01:00
|
|
|
`curl --head {{http://localhost}}`
|
2014-03-11 16:01:45 +01:00
|
|
|
|
|
|
|
- pass a user name and password for server authentication
|
|
|
|
|
|
|
|
`curl -u myusername:mypassword {{http://localhost}}`
|