Networking & SSH EssentialsLesson 5.4
curl and wget for HTTP requests from terminal
curl GET POST, headers, authentication, follow redirects, output to file, wget recursive download, API testing with curl, JSON payloads
curl Is a Swiss Army Knife for HTTP
curl makes HTTP requests from the terminal. It supports every HTTP method, custom headers, authentication, and form data. It is the standard tool for testing APIs, hitting webhooks, and automating HTTP interactions in scripts.
Common curl Patterns
# Simple GET request
curl https://api.example.com/status
# GET with pretty printed output
curl https://api.example.com/users | python3 -m json.tool
# POST with JSON body
curl -X POST https://api.example.com/users \
-H "Content-Type: application/json" \
-d '{"name": "Alice", "email": "alice@example.com"}'
# Add Authorization header (Bearer token)
curl -H "Authorization: Bearer $TOKEN" \
https://api.example.com/protected
# Download file and save with original name
curl -O https://example.com/file.tar.gz
# Follow redirects, show response headers
curl -L -I https://example.com
# Basic auth
curl -u username:password https://api.example.com/wget for Downloads
# Download a file
wget https://example.com/archive.tar.gz
# Resume interrupted download
wget -c https://example.com/large_file.iso
# Download in background
wget -b https://example.com/large_file.iso