Operations 25 min read

Mastering aria2: Fast, Lightweight Command-Line Downloading

This guide provides a comprehensive overview of aria2, a lightweight and efficient command-line download tool, covering its supported protocols, unique multi-source features, installation steps, basic and advanced usage examples, and detailed configuration options for optimal performance.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Mastering aria2: Fast, Lightweight Command-Line Downloading

aria2 is a lightweight, high‑efficiency command‑line download utility that supports multiple protocols (HTTP(S), FTP, BitTorrent, Metalink) and can download from multiple sources simultaneously, maximizing bandwidth utilization.

Installation

Install aria2 using the package manager of your operating system:

# Ubuntu
sudo apt-get install aria2

# CentOS
sudo yum install aria2

Basic Usage

Download a single file: aria2c "https://www.example.com/file.zip" Download multiple files in parallel (use -Z to enable batch mode):

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

Specify output filename:

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

Resume an interrupted download: aria2c -c "https://www.example.com/file.zip" Set the number of connections per server (e.g., 8 parallel connections): aria2c -x 8 "https://www.example.com/file.zip" Limit the maximum number of parallel downloads (e.g., 8):

aria2c -j 8 "https://www.example.com/file1.zip" "https://www.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://www.example.com/file.zip"

Limit download speed (e.g., 500 KB/s):

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

Advanced Operations

Download a BitTorrent torrent file: aria2c "https://www.example.com/file.torrent" Download via a magnet link: aria2c "magnet:?xt=urn:btih:YOUR_HASH" List files contained in a torrent ( -S) and select specific files to download ( --select-file):

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

Configuration File

aria2 can be customized via a configuration file (default location $HOME/.aria2/aria2.conf). Below are key options with their typical defaults:

# Download directory
 dir=

# Maximum concurrent downloads
 max-concurrent-downloads=5

# Enable/disable integrity check (for BT, Metalink, HTTP/HTTPS with checksum)
 check-integrity=false

# Continue partially downloaded files
 continue=true

# Maximum connections per server
 max-connection-per-server=1

# Minimum split size (default 1M)
 min-split-size=20M

# Enable DHT (IPv4)
 enable-dht=true

# Enable DHT (IPv6)
 enable-dht6=

# Enable peer exchange
 enable-peer-exchange=true

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

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

# Enable color output in terminal
 enable-color=true

# Human‑readable size output
 human-readable=true

# Log level
 log-level=debug

# Save session file path
 save-session=$HOME/.aria2/aria2.session

# Auto‑save interval (seconds)
 auto-save-interval=60

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

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

# Enable asynchronous DNS resolution
 async-dns=true

# Enable MMap (memory‑mapped file I/O)
 enable-mmap=false

# Enable SSL/TLS for RPC
 rpc-secure=

# Other useful flags (examples):
 quiet=false          # Show progress
 always-resume=true  # Always resume if possible

These settings allow fine‑grained control over connection handling, bandwidth limits, proxy configuration, BitTorrent behavior, and RPC interaction, making aria2 suitable for both simple file retrieval and complex automated download pipelines.

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.

automationConfigurationcommand-lineDownloadaria2bitTorrent
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.