# aria2 — Multi-Connection Downloads from the Command Line

> Practical guide to aria2c — HTTP/HTTPS/FTP/BitTorrent downloads with multiple simultaneous connections, resume support and a JSON-RPC daemon.

Source: https://www.jpkc.com/db/en/cheatsheets/networking/aria2/

<!-- PROSE:intro -->
aria2 is a lightweight, multi-protocol download utility built for speed: the `-x` and `-s` flags split a single file into segments and fetch them over multiple connections simultaneously – making it significantly faster than single-connection tools. It handles HTTP/HTTPS, FTP, BitTorrent and Metalink in one command, resumes interrupted downloads seamlessly, and exposes a JSON-RPC interface so you can queue and control downloads remotely from frontends or scripts.
<!-- PROSE:intro:end -->

## Basic Downloads

`aria2c <url>` — Download a file from a URL.

```bash
aria2c https://example.com/file.tar.gz
```

`aria2c -o <filename> <url>` — Download and save with a custom filename.

```bash
aria2c -o backup.tar.gz https://example.com/archive-v2.tar.gz
```

`aria2c -d <dir> <url>` — Download to a specific directory.

```bash
aria2c -d ~/Downloads https://example.com/file.zip
```

`aria2c -c <url>` — Resume a partially downloaded file.

```bash
aria2c -c https://example.com/large-file.iso
```

`aria2c -i <file>` — Download URLs listed in a text file (one per line).

```bash
aria2c -i urls.txt
```

## Multi-Connection & Speed

`aria2c -x <n> <url>` — Use multiple connections per server (max per host).

```bash
aria2c -x 8 https://example.com/large-file.iso
```

`aria2c -s <n> <url>` — Split download into N pieces across connections.

```bash
aria2c -s 16 https://example.com/large-file.iso
```

`aria2c -j <n> -i <file>` — Download N files in parallel from a URL list.

```bash
aria2c -j 5 -i urls.txt
```

`aria2c --max-download-limit=<speed> <url>` — Limit download speed (e.g., 500K, 2M).

```bash
aria2c --max-download-limit=1M https://example.com/file.iso
```

`aria2c --max-overall-download-limit=<speed> -i <file>` — Limit total download speed across all downloads.

```bash
aria2c --max-overall-download-limit=5M -i urls.txt
```

`aria2c --min-split-size=<size> <url>` — Set minimum size for each split piece.

```bash
aria2c -x 8 --min-split-size=10M https://example.com/file.iso
```

## Multiple Sources & Mirrors

`aria2c <url1> <url2> <url3>` — Download same file from multiple mirrors simultaneously.

```bash
aria2c https://mirror1.example.com/file.iso https://mirror2.example.com/file.iso
```

`aria2c -M <metalink>` — Download using a Metalink file (multiple mirrors + checksums).

```bash
aria2c -M download.metalink
```

`aria2c --checksum=sha-256=<hash> <url>` — Verify download integrity with a checksum.

```bash
aria2c --checksum=sha-256=abc123... https://example.com/file.iso
```

## BitTorrent

`aria2c <torrent-file>` — Download from a torrent file.

```bash
aria2c ubuntu-24.04-desktop-amd64.iso.torrent
```

`aria2c '<magnet-link>'` — Download using a magnet link.

```bash
aria2c 'magnet:?xt=urn:btih:abc123...'
```

`aria2c --seed-time=0 <torrent>` — Download and exit immediately without seeding.

```bash
aria2c --seed-time=0 file.torrent
```

`aria2c --select-file=<indices> <torrent>` — Download only specific files from a torrent.

```bash
aria2c --select-file=1,3,5 file.torrent
```

`aria2c -S <torrent>` — Show files in a torrent without downloading.

```bash
aria2c -S file.torrent
```

## Authentication & Headers

`aria2c --http-user=<user> --http-passwd=<pass> <url>` — Download with HTTP Basic Authentication.

```bash
aria2c --http-user=admin --http-passwd=secret https://private.example.com/file.zip
```

`aria2c --header='<header>' <url>` — Add a custom HTTP header.

```bash
aria2c --header='Authorization: Bearer token123' https://api.example.com/export
```

`aria2c --ftp-user=<user> --ftp-passwd=<pass> <url>` — Download from FTP with credentials.

```bash
aria2c --ftp-user=admin --ftp-passwd=secret ftp://ftp.example.com/backup.tar.gz
```

`aria2c --all-proxy=<proxy> <url>` — Use a proxy for downloads.

```bash
aria2c --all-proxy=http://proxy:8080 https://example.com/file.zip
```

## RPC & Daemon Mode

`aria2c --enable-rpc` — Start aria2 as a daemon with JSON-RPC interface.

```bash
aria2c --enable-rpc --rpc-listen-all=true --daemon
```

`aria2c --enable-rpc --rpc-secret=<token>` — Start RPC daemon with authentication token.

```bash
aria2c --enable-rpc --rpc-secret=mysecret --daemon
```

`aria2c --conf-path=<file>` — Use a custom configuration file.

```bash
aria2c --conf-path=~/.config/aria2/aria2.conf
```

`aria2c --save-session=<file> --save-session-interval=60` — Save download session for later resume.

```bash
aria2c --save-session=session.txt --save-session-interval=60 -i urls.txt
```

`aria2c --input-file=<session-file>` — Restore downloads from a saved session.

```bash
aria2c --input-file=session.txt
```

<!-- PROSE:outro -->
## Conclusion

aria2 shines on large files and congested links: multiple connections and mirror support squeeze every bit of available bandwidth. For recurring download tasks, pair an `aria2.conf` with the RPC daemon – this lets you manage queues from frontends like Aria2 Web UI or browser extensions without opening a new terminal each time.

## Further Reading

- [aria2 – official documentation](https://aria2.github.io/) – manual and RPC reference
- [aria2c(1) – manual page](https://aria2.github.io/manual/en/html/aria2c.1.html) – every option at a glance
- [aria2 – Wikipedia](https://en.wikipedia.org/wiki/Aria2) – background and history
<!-- PROSE:outro:end -->

## Related Commands

- [wget](https://www.jpkc.com/db/en/cheatsheets/networking/wget/) – download files and directory trees from servers
- [curl](https://www.jpkc.com/db/en/cheatsheets/networking/curl/) – HTTP requests, APIs and downloads on the command line
- [scp](https://www.jpkc.com/db/en/cheatsheets/networking/scp/) – transfer files securely over SSH

