How to Download List of Files Using aria2?

This article provides a quick, practical guide on how to configure and use aria2, a lightweight multi-protocol command-line download utility, to download multiple files simultaneously from a text file list. You will learn how to prepare your input file, trigger the download command, and utilize advanced flags to optimize download speeds and manage your queue effectively.


Preparing Your Input File

Before running aria2, you need to create a plain text file containing the URLs you want to download. Each URL must be on a new line. You can also add specific configuration options directly below a URL for advanced control.

Example of a basic input file:

https://example.com/file1.zip
https://example.com/file2.mp4
https://example.com/file3.iso

The Basic Command

Once your text file is ready, open your terminal or command prompt, navigate to the directory where your text file is saved, and use the -i (or --input-file) option.

aria2c -i download-list.txt

When you execute this command, aria2 will read the file and start downloading the inputs sequentially or concurrently, depending on your settings.


Optimizing the Download Configuration

To make the most out of aria2’s powerful downloading engine, you can append various flags to customize how the text file is processed.

1. Concurrent Downloads

By default, aria2 may not download all files at the same time. To change the number of parallel downloads, use the -j (max concurrent downloads) flag:

aria2c -i download-list.txt -j 5

This splits the workload so that 5 files from your list download simultaneously.

2. Multiple Connections per File

To speed up the download of each individual file in your list, you can allow aria2 to establish multiple connections to the same server using the -x flag:

aria2c -i download-list.txt -j 3 -x 4

This configuration allows 3 files to download at once, with each file utilizing up to 4 connections.

3. Automatically Resuming Interrupted Downloads

If your connection drops, you can tell aria2 to automatically resume partial downloads instead of starting over by adding the -c flag:

aria2c -c -i download-list.txt

Advanced Text File Formatting

aria2 allows you to customize options for specific files inside your text file. If you want to change the output name or directory for just one item in your list, format your text file like this:

https://example.com/image.png
  out=custom-name.png
  dir=/home/user/downloads/images
https://example.com/video.mp4
  out=holiday-video.mp4

Note: The options must be placed on the lines immediately following the target URL and must be indented by at least one space or tab character.