Steve August 6, 2020
how-to-download-any-file-from-different-protocols-with-aria2

Are you tired of having to juggle multiple tools to download files from various sources? If you’re wondering why nobody has created a tool that can deal with HTTP, HTTPS, FTP, and BitTorrent downloads, it’s time you met aria2. Let’s see how you can use it to simplify the way you download files from the Internet.

Installation

Aria2 is cross-platform compatible and is available for Windows, macOS, Linux and even Android. You can find the installer at its GitHub page.

You can find the Android version in Google Play. For Linux, you should be able to find it in your repositories/software center/package manager. If you are on Ubuntu, Debian, you can bring it on board with:

Download Everything With Aria2 Apt Install

Let’s Download with aria2c

Linux distributions are a great way to see aria2’s versatility in action since they (usually) offer multiple different sources for their installation ISO’s. For this tutorial we will use Ubuntu’s installation ISO.

1. Start by visiting its download page.

Download Everything With Aria2 Download Ubuntu

2. Click on the “see our alternative downloads” hyperlink underneath the “Download” button.

Download Everything With Aria2 Alternative Downloads

3. Click on the “See all Ubuntu mirrors” link.

Download Everything With Aria2 All Mirrors

4. When you have a list of HTTPS, HTTPS, and FTP links to the ISO, copy one to the clipboard and fire up your favorite terminal. Type the following command:

Hit Enter and aria2 will start downloading the file.

In the photo below, you can see aria2 downloading the file from an HTTPS source.

Download Everything With Aria2 Download Https

If the process is interrupted, you can resume your file download by using the same command. What’s even better is that you can resume the download even from other sources as long as the file remains identical.

In the following image we interrupted our HTTPS download and swapped the source for an FTP one. Aria2 resumed from where it had been stopped.

Download Everything With Aria2 Resume With Ftp

Do you remember the page with the BitTorrent links we suggested you leave open in your browser? Return to that and click on the “Ubuntu 20.04 Desktop (64-Bit)” link to download a torrent file. For ease of use, save it to the same directory where you are test-downloading the Ubuntu ISO.

Let’s say you have the torrent file for the Ubuntu ISO. To use the torrent file as the input, use its filename instead of a URL after aria2c, similar to the following:

Download Everything With Aria2 Download Torrent With Wildcard

As before, and although we were using a different transfer protocol, aria2 resumed the download.

Download Everything With Aria2 Torrent Resume

Switches Worth Using

Aria2 comes with some useful switches that allow you to optimize the download process:

  • -c: Don’t re-download file if it already exists.
  • -i: Use a TXT file with a list of URLs as the source – useful for downloading multiple files in one go.
  • -j: Followed by a number, and used in conjunction with an option like the previous one, it defines how many files aria 2 can download in parallel. If, for example, you use an input file containing 20 URLs with the above switch and use -j 3, aria 2 will start downloading three of those files in parallel. When one of them completes, it will move to the next one on the list.
  • -o: Allows you to define an output name for the downloaded file. Useful to, for example, turn back “21820198465.mp4” to “our_vacation_video.mp4,” without having to rename the file manually after the download completes.
  • -x: Number of parallel connections for each download. Not to be confused with the -j switch, this splits a file in multiple chunks and downloads them through parallel connections to maximize the download speed. It’s worth noting, though, that many file hosts put limits on the connections allowed since they drain their resources. Typical web servers usually allow up to eight connections in parallel, but you may find that some file servers restrict you even down to a single connection.

No GUI?

If you are looking for a user interface for this command line tool, you should check out Persepolis, which is a GUI for Aria2

You can use those switches together and even mix different sources (like HTTP & BitTorrent) in a single file_list.txt you use as an input.

What is your favorite way to download files from the Internet? If instead you want to save a file to multiple folders, here is a trick for you to do so.

Related:

Is this article useful?

Read More