Using the wget
Command in the ChromeOS Linux Environment
The wget
command is a powerful tool for downloading files from the internet via the command line. It supports HTTP, HTTPS, and FTP protocols and is useful for automating downloads in the ChromeOS Linux (Crostini) environment.
Installing wget
(If Not Preinstalled)
Most ChromeOS Linux environments include wget
by default. However, if it is missing, you can install it using:
sudo apt update && sudo apt install wget
Basic Usage
Downloading a File
To download a file from a URL, use:
wget https://example.com/file.zip
Downloading to a Specific Directory
To specify a directory for the downloaded file:
wget -P /path/to/destination https://example.com/file.zip
Resuming a Download
If a download was interrupted, you can resume it with:
wget -c https://example.com/file.zip
Downloading Multiple Files
Create a text file (urls.txt
) containing URLs, one per line, and download them all:
wget -i urls.txt
Downloading a Website Recursively
To download an entire website for offline browsing:
wget -r https://example.com/
Limiting Download Speed
To limit the download speed to prevent bandwidth overuse:
wget --limit-rate=100k https://example.com/file.zip
Downloading with a Specific User Agent
Some websites block unknown user agents. You can specify a browser user agent:
wget --user-agent="Mozilla/5.0" https://example.com/file.zip
Authentication with Username and Password
To download from a password-protected site:
wget --user=username --password=password https://example.com/protected.zip
Skipping SSL Certificate Verification
If encountering SSL errors, you can bypass verification (not recommended for security reasons):
wget --no-check-certificate https://example.com/file.zip
Practical Use Cases
- Downloading files directly to ChromeOS Linux:
wget https://example.com/software.deb
- Automating multiple downloads with a list of URLs:
wget -i urls.txt
- Mirroring an entire website for offline access:
wget -r https://example.com/
Conclusion
The wget
command is an essential tool for downloading files efficiently in the ChromeOS Linux environment. With its powerful features, it is invaluable for both simple file retrieval and complex download automation.