Operations 25 min read

Mastering aria2: Fast, Lightweight Command-Line Download Tool

This guide introduces aria2, a lightweight and efficient command‑line downloader supporting HTTP, FTP, BitTorrent, and Metalink, explains how to install it on Linux, demonstrates basic and advanced usage commands, and provides a comprehensive overview of its configuration options for optimal performance.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Mastering aria2: Fast, Lightweight Command-Line Download Tool

Introduction

aria2 is a lightweight, high‑efficiency command‑line download utility that supports HTTP(S), FTP, BitTorrent and Metalink. It maximises bandwidth utilisation by downloading from multiple sources concurrently and can verify file integrity using Metalink hashes.

Key Features

Concurrent multi‑protocol downloading

Multiple source URLs per file

Automatic integrity checking via Metalink

Intelligent piece selection and adaptive re‑splitting

Installation

# Ubuntu
sudo apt-get install aria2

# CentOS
sudo yum install aria2

Basic Usage

Official manual: https://aria2.github.io/manual/en/html/index.html

Download a single file

aria2c "https://example.com/file.zip"

Download multiple files

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

Expand URL patterns

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

Specify output filename

aria2c -o myfile.zip "https://example.com/file.zip"

Resume interrupted downloads

aria2c -c "https://example.com/file.zip"

Set number of connections per server

aria2c -x 8 "https://example.com/file.zip"

Set maximum parallel connections per file

aria2c -s 8 "https://example.com/file.zip"

Set maximum parallel download tasks

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

Read URLs from a file

aria2c -i download_list.txt

Download to a specific directory

aria2c -d /path/to/dir "https://example.com/file.zip"

Limit download speed

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

Advanced Operations

Download a BitTorrent torrent file

aria2c "https://example.com/file.torrent"

Download via magnet link

aria2c "magnet:?xt=urn:btih:YOUR_HASH"

List files in a magnet link

aria2c -S "magnet:?xt=urn:btih:YOUR_HASH"

Select specific files from a torrent

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

Configuration File Overview

Common options for ~/.aria2/aria2.conf (default values shown). Adjust as needed.

# Download directory
 dir=

# Log file path ("-" for stdout)
 log=

# Maximum concurrent downloads
 max-concurrent-downloads=5

# Enable integrity check (BT/Metalink)
 check-integrity=false

# Continue partially downloaded files
 continue=true

# Proxy settings (all protocols)
 all-proxy=
 all-proxy-user=
 all-proxy-passwd=

# Connection timeout (seconds)
 connect-timeout=60

# Enable DHT (IPv4)
 enable-dht=true

# Enable peer exchange
 enable-peer-exchange=true

# Maximum overall download speed (0 = unlimited)
 max-overall-download-limit=0

# Maximum per‑task download speed (0 = unlimited)
 max-download-limit=0

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

# Enable colour output in terminal
 enable-color=true

# Enable async DNS resolution
 async-dns=true

# Enable RPC server (disabled by default)
 enable-rpc=false
 rpc-listen-port=6800

# Save session file path
 save-session=
 save-session-interval=0

# Enable HTTP keep‑alive
 enable-http-keep-alive=true

# Enable HTTP pipelining
 enable-http-pipelining=false

# Accept GZip encoding
 http-accept-gzip=false

# Verify SSL/TLS certificates
 check-certificate=true

# User‑agent string
 user-agent=aria2/$VERSION

Helpful Tips

Wrap URLs containing special characters (e.g., &, *) in single or double quotes.

Use -h to search options, e.g., aria2c -h connection.

For large files, increase piece-length and adjust max-connection-per-server to improve throughput.

Enable async-dns to reduce DNS lookup latency.

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.