Source: How to download files on Linux without a web browser (and why you should) | ZDNET
must read
Sonos is failing and millions of devices could go with it – why open-source audio is our only hope
Read now
When you want to download files from the internet, you typically open your web browser, go to the file in question, and let the downloading commence. But did you know there’s a much better way? That way is the wget command.
The wget command uses multiple simultaneous connections that result in much faster downloads. On top of that, wget is capable of resuming downloads that were interrupted by networking issues. Besides, unlike web browsers, wget isn’t burdened by cookies, add-ons, and other features that can slow it down or make it less reliable — especially helpful when you need to download a larger file. Why relegate that to your browser?
Instead, if you’re using Linux, opt to go the wget route. Let me show you how.
How to install wget
What you’ll need: To make use of wget, you’ll need a running instance of Linux and a user with sudo privileges (for the installation).
1. Open a terminal window and install wget
Wget should be installed on your distribution by default. If not, here’s how to get it. Log into Linux and open a terminal window. From there, here are the commands for installing wget on Ubuntu, Arch, and Fedora-based distributions.
- For Ubuntu-based distributions – sudo apt-get install wget -y
- For Arch-based distributions – sudo pacman -S wget
- For Fedora-based distributions – sudo dnf install wget -y
Also: Linux might be your best bet for heightening your desktop computer security
2. Using wget
Wget is used from the command line only, so keep your terminal window open. Let’s say you want to download an ISO for Ubuntu Desktop Linux and you’ve found the link (from the official download site) which is https://releases.ubuntu.com/22.04.3/ubuntu-22.04.3-desktop-amd64.iso. Instead of downloading that from your browser, you could simply run the command:
wget https://releases.ubuntu.com/22.04.3/ubuntu-22.04.3-desktop-amd64.iso
One thing to keep in mind is that the file will download in the directory in which you are currently working.
3. Saving a file to a different directory
Let’s say you have the directory /ISOS and you want to download the Ubuntu ISO to that directory. For that, you use the -P option (for Path), like so:
wget -P /ISO/ https://releases.ubuntu.com/22.04.3/ubuntu-22.04.3-desktop-amd64.iso
How to download multiple files at once with wget
Here’s another cool trick. With wget, you can download multiple files at once. Here’s how.
1. Create a file to house the addresses
First, you need to create a new file that will house the URLs for the files to be downloaded. Let’s say you want to download ISO files for Ubuntu, Fedora, and Arch Linux. Create the file with the command:
nano downloads
In that file, add the three URLs for the downloads, like so:
https://releases.ubuntu.com/22.04.3/ubuntu-22.04.3-desktop-amd64.iso https://download.fedoraproject.org/pub/fedora/linux/releases/39/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-39-1.5.iso http://mirrors.acm.wpi.edu/archlinux/iso/2023.12.01/archlinux-2023.12.01-x86_64.iso
Save and close the file.
2. Start the download
To start the download, issue the command:
wget -i downloads
You can then walk away and let the downloads complete.
3. Continue an interrupted download
Let’s say a download gets interrupted. Instead of downloading the entire file again, just run the command with the -c option, like so:
wget -c https://releases.ubuntu.com/22.04.3/ubuntu-22.04.3-desktop-amd64.iso
If you’re downloading via a file (as we did above) and it gets interrupted, you could continue it like so:
wget -c -i downloads
And that’s all there is to use the wget to more reliably (and quickly) download files to your Linux machine.