Fundamentals 25 min read

Master aria2: Fast, Lightweight Command‑Line Downloading Explained

This guide introduces aria2, a lightweight yet powerful command‑line downloader that supports multiple protocols, explains how to install it on Linux, demonstrates essential commands for single and batch downloads, covers advanced BitTorrent features, and provides a detailed overview of its extensive configuration options.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master aria2: Fast, Lightweight Command‑Line Downloading Explained

Overview

aria2 is a lightweight, high‑efficiency command‑line download tool that supports multiple protocols: HTTP(S), FTP, BitTorrent (with DHT, PEX, MSE/PE) and Metalink. It splits files into 1 MiB pieces, opens several connections per server, and automatically replaces slow connections with faster ones, which improves download speed and reliability. Metalink’s chunk checksums are used to verify data integrity during download.

Installation

sudo apt-get install aria2   # Ubuntu/Debian</code>
<code>sudo yum install aria2       # CentOS/RHEL

Basic Usage

Download a single file: aria2c "https://example.com/file.zip" Download several files in parallel (‑Z):

aria2c -Z "https://example.com/file1.zip" "https://example.com/file2.zip"

Use brace expansion to generate many URLs (‑P):

aria2c -Z -P "https://example.com/image{1,2,3}_{A,B,C}.png"

Specify output name (‑o): aria2c -o index.html "https://example.com/" Resume a partially downloaded file (‑c): aria2c -c "https://example.com/largefile.iso" Increase connections per server (‑x) and parallel connections per file (‑s): aria2c -x 8 -s 8 "https://example.com/" Limit total parallel downloads (‑j):

aria2c -Z -j 8 "https://example.com/file1" "https://example.com/file2"

Read URLs from a file (‑i): aria2c -i download_list.txt Save files to a specific directory (‑d):

aria2c -d /home/user/downloads "https://example.com/"

Limit download speed (‑‑max-download-limit):

aria2c --max-download-limit=500k "https://example.com/"

Advanced Operations

Download a BitTorrent torrent file: aria2c "https://example.com/file.torrent" Download via a magnet link: aria2c "magnet:?xt=urn:btih:YOUR_HASH_HERE" List files contained in a torrent (‑S): aria2c -S "https://example.com/file.torrent" Select specific files from a torrent (‑‑select-file):

aria2c --select-file=1,3 "https://example.com/file.torrent"

Configuration File (default: ~/.aria2/aria2.conf)

Key options that are commonly tuned:

# Directory where downloads are saved
 dir=/path/to/downloads

# Maximum number of concurrent downloads
 max-concurrent-downloads=5

# Enable resume of partially downloaded files
 continue=true

# Maximum connections per server (default 1)
 max-connection-per-server=8

# Minimum size of each split piece (affects how files are divided)
 min-split-size=20M

# Enable DHT and peer exchange for BitTorrent
 enable-dht=true
 enable-peer-exchange=true

# Global download/upload speed limits (0 = unlimited)
 max-overall-download-limit=0
 max-overall-upload-limit=0

# Save session periodically (useful for resuming after a crash)
 save-session=~/.aria2/aria2.session
 save-session-interval=60

# Enable colored output in the terminal
 enable-color=true

# Use pre‑allocation to avoid file fragmentation
 file-allocation=prealloc

# Piece length for HTTP/FTP downloads (default 1M)
 piece-length=1M

# Enable asynchronous DNS resolution for faster name lookups
 async-dns=true

# Show human‑readable sizes and speeds in the console
 human-readable=true

# Limit the number of open files (important for large batch downloads)
 max-open-files=100

# Enable RPC interface (default disabled)
 enable-rpc=false

# Log level (debug, notice, info, warn, error)
 log-level=notice

Reference

Full option reference and examples are available in the official manual: https://aria2.github.io/manual/en/html/index.html

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

ConfigurationTutorialcommand-lineDownloadaria2
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.