Linux shell commands 103

Chapter 3 About Network

1 Downloads utils

1.1 wget

wget URL
wget URL1 URL2
# Downloaded file name and print logs to file
wget URL -O down.file -o down.log
# Try 5 times
wget -t 5 URL
# Limit speed
wget --limit-rate 20k URL
# Quota of download
wget -Q 100m URL
# Resume downloading and continue
wget -c URL
# Authentication for HTTP FTP
wget --user NAME --password PASS URL
# Copy webpage as formatted txt
lynx -dump URL > webpage.txt
# Copy a complete website
wget --mirror URL
wget -r -N -l DEPTH URL

1.2 curl

# More powerful tool
curl URL --slient
curl URL > index.html
# Write to file not ~stdout~
curl URL --slient -O
curl URL --slient -o NEW_FILE
# Progress bar
curl URL --progress -o NEW_FILE
# Resume
curl URL/file -C offset
# Cookies
curl URL --cookie-jar cookie_file
# User agent
curl URL --user-agent "Mozilla/5.0"
# Header
curl -H "Host: www.archlinux.org" -H "Accept-language: en" URL
# Limit speed/bandwidth
curl URL --limit-rate 20k
# Quota of download
curl URL --max-filesize bytes
# Authentication for HTTP FTP
curl -u USER:PASS URL
curl -u USER URL
# Dump only HTTP headers without downloading file
curl -I URL
curl -head URL

1.3 others

axel URL --slient -o
httpie URL