Index

Table of contents

Network

wget

get request
wget localhost:8080/path/file.zip
authentication
wget --user=me --password=secret [url]
wget --user=me --ask-password    [url]
specify destination directory, keep remote file name
wget [url] -P [dir]
specify destination file
wget [url] -O [destination]
download recursively, but don't traverse parents
wget -r -np [url]
hide progress
wget -nv [url]
do not follow redirects
wget "http://example.com" --max-redirect=0
bypass certificate security checks
wget --no-check-certificate https://example.com/unsafe.html

curl

verbose
curl -v http://example.com
post request
curl -X POST [url]
post request with data
curl -X POST [url] -d "param1=value1&param2=value2"
curl -X POST [url] --data "param1=value1&param2=value2"
curl --data "@filename"
curl --data "@/path/to/file"
echo "param=value" | curl -X POST -d @- [url]
upload a file:
curl -X PUT [url] -F "file=@put.zip"
authentication
curl -u [username]:[password] [url]
authentication using .netrc config file
curl -n
echo "machine example.com login [user] password [password]" >> ~/.netrc
chmod 400 ~/.netrc
header
curl -H "Content-Type: application/json" [url]
curl --header "Content-Type: application/json" [url]
cookie
curl -b "JSESSIONID=cookievalue" [url]
curl silent (hide progress bar)
curl -s [url]
follow redirects
curl -L [url]
curl --location [url]
timeout if cant connect
curl --connect-timeout [seconds] [url]
use socks proxy
curl --preproxy [host]:[port] [url]
do DNS lookup
host [domain]