Linux wget curl Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki

Linux wget and curl Guide

Complete beginner-friendly guide to wget and curl on Linux, covering Arch Linux, CachyOS, and other distributions including file downloads, HTTP requests, and web interactions.


Table of Contents

  1. wget Installation
  2. wget Usage
  3. curl Installation
  4. curl Usage
  5. Troubleshooting

wget Installation

Install wget

Arch/CachyOS:

# Install wget
sudo pacman -S wget

# Usually pre-installed

Debian/Ubuntu:

sudo apt install wget

Fedora:

sudo dnf install wget

wget Usage

Download File

Basic download:

# Download file
wget https://example.com/file.zip

# Download with output name
wget -O myfile.zip https://example.com/file.zip

# Resume download
wget -c https://example.com/file.zip

Recursive Download

Download website:

# Download entire site
wget -r https://example.com

# Limit depth
wget -r -l 2 https://example.com

curl Installation

Install curl

Arch/CachyOS:

# Install curl
sudo pacman -S curl

# Usually pre-installed

Debian/Ubuntu:

sudo apt install curl

Fedora:

sudo dnf install curl

curl Usage

Download File

Basic download:

# Download file
curl -O https://example.com/file.zip

# Download with name
curl -o myfile.zip https://example.com/file.zip

# Follow redirects
curl -L https://example.com/file.zip

HTTP Requests

GET request:

# GET request
curl https://api.example.com/data

# POST request
curl -X POST -d "data=value" https://api.example.com/endpoint

Troubleshooting

Download Errors

Check connection:

# Test connection
ping example.com

# Check URL
curl -I https://example.com

Summary

This guide covered wget and curl installation, file downloads, and HTTP requests for Arch Linux, CachyOS, and other distributions.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.