π Linux/Unix: Web Tools β wget, curl, lynx Explained with Practical Examples
π§² Introduction β Why Learn Web Tools in Linux?
Linux provides powerful CLI tools to access, download, and interact with web resources directly from the terminal. Whether you’re fetching files, making HTTP requests, or browsing the web in a terminal, tools like wget, curl, and lynx are essential for developers, sysadmins, and automation scripts.
π― In this guide, youβll learn:
- How to download files using wget
- How to make web requests and APIs with curl
- How to browse the web from the terminal using lynx
- Real-world examples and outputs for each tool
π₯ 1. wget β Non-Interactive File Downloader
β
 What is wget?
wget is a command-line utility to download files from the web using HTTP, HTTPS, or FTP protocols.
π οΈ Syntax:
wget [options] URL
πΉ Common Options:
| Option | Description | 
|---|---|
| -c | Resume partially downloaded file | 
| -O | Save with a custom filename | 
| -r | Recursive download | 
| --limit-rate | Limit download speed | 
π§ͺ Example 1: Download a file
wget https://example.com/file.zip
π§ͺ Example 2: Resume a broken download
wget -c https://example.com/large.iso
π§ͺ Example 3: Save with a custom name
wget -O latest.html https://example.com
π€ Output:
Saving to: βlatest.htmlβ
HTTP request sent, awaiting response... 200 OK
π‘ 2. curl β Transfer Data from or to a Server
β
 What is curl?
curl is a command-line tool to send requests and receive responses from URLs. It supports HTTP, FTP, SFTP, and more.
π οΈ Syntax:
curl [options] [URL]
πΉ Common Options:
| Option | Description | 
|---|---|
| -o | Save to file | 
| -I | Fetch headers only | 
| -d | Send data in POST requests | 
| -X | Specify HTTP method (GET, POST, etc) | 
| -H | Add custom header | 
π§ͺ Example 1: Download a webpage
curl https://example.com
π§ͺ Example 2: Save output to file
curl -o page.html https://example.com
π§ͺ Example 3: Send POST data to an API
curl -X POST -d "name=Vaibhav&age=25" https://httpbin.org/post
π€ Output (JSON):
{
  "form": {
    "age": "25",
    "name": "Vaibhav"
  }
}
π 3. lynx β Terminal-Based Web Browser
β
 What is lynx?
lynx is a text-based web browser that lets you navigate websites right from the terminal.
π οΈ Syntax:
lynx [options] [URL]
π¦ Install it using:
sudo apt install lynx
π§ͺ Example 1: Open a website in the terminal
lynx https://example.com
π€ Output: A keyboard-navigable text UI of the webpage.
π§ Navigation Keys:
- β / β: Move through links
- β: Follow a link
- q: Quit
- g: Enter a new URL
βοΈ Web Tools Comparison Table
| Tool | Main Use | Supports | GUI Needed | Best For | 
|---|---|---|---|---|
| wget | File downloads | HTTP/FTP | β | Automated bulk or scheduled pulls | 
| curl | API calls & data transfers | HTTP/FTP/SMTP | β | Web APIs, headers, scripting | 
| lynx | Text-based web browsing | HTTP/HTTPS | β | Browsing in terminal or SSH-only | 
π Summary β Recap & Next Steps
These web tools make Linux a powerful platform for interacting with the internetβwhether you’re downloading, debugging APIs, or browsing sites in restricted environments.
π Key Takeaways:
- Use wgetfor robust downloading and automation.
- Use curlfor web requests, APIs, and data posting.
- Use lynxto browse websites in a terminal-only environment.
β FAQs
β Whatβs the difference between wget and curl?
β
 wget is best for downloading entire files or sites. curl is more flexible for sending/receiving custom HTTP requests.
β Can wget handle recursive downloads?
β
 Yes, use wget -r URL for entire websites (respect robots.txt).
β How can I view only HTTP headers with curl?
β
 Use:
curl -I https://example.com
β Is lynx useful without a GUI?
β
 Absolutely. It lets you browse web content in SSH or headless environments.
β Can I download an entire site with wget?
β
 Yes:
wget -r -np -k https://example.com
Share Now :
