aria2c Command: Tutorial & Examples
Download files using different protocols
aria2c
is a free and open-source command-line download utility that supports downloading files from various protocols, including HTTP/HTTPS, FTP, BitTorrent, and Metalink. It is available for Linux, macOS, Windows, and Android.
Using aria2c
, you can download files in parallel from multiple sources, significantly increasing your download speed. Additionally, aria2c
supports resuming downloads that have been interrupted, which can be helpful if you have a slow or unreliable internet connection.
How aria2c works
aria2c
operates by splitting files into multiple segments and downloading each segment from different sources simultaneously. This multi-source downloading allows for faster retrieval of data and can optimize bandwidth usage. By utilizing various protocols, aria2c
can dynamically adjust to the best available sources, enhancing download efficiency.
What aria2c does
aria2c
can download files from:
- HTTP/HTTPS: For standard web downloads.
- FTP: For traditional file transfer protocol downloads.
- BitTorrent: For downloading files shared via the BitTorrent protocol.
- Metalink: For downloading files with metadata that includes multiple sources.
What aria2c is used for
Common use cases for aria2c
include:
- Downloading large files quickly.
- Resuming interrupted downloads.
- Downloading files from multiple sources to improve speed.
- Managing and organizing downloads through command-line interfaces.
- Automating downloads through scripts, making it useful for system administrators and developers.
Why aria2c is important
aria2c
is particularly valuable for users who work in environments where bandwidth is limited or unstable. Its ability to resume downloads and utilize multiple sources can save time and resources, making it an essential tool for system administrators and developers. Additionally, its command-line nature allows integration with other tools and scripts, enhancing productivity in automated environments.
How to use aria2c
Here are some examples of how to use aria2c
with command-line parameters:
Download a file using HTTP/HTTPS:
aria2c https://example.com/myfile.zip
Download a file using FTP:
aria2c ftp://example.com/myfile.zip
Download a file using BitTorrent:
aria2c myfile.torrent
Download a file using Metalink:
aria2c myfile.metalink
Download a file in multiple parts (up to 16 parts by default):
aria2c -s16 http://example.com/myfile.zip
Set a download speed limit (in this example, 1MB/s):
aria2c --max-download-limit=1M http://example.com/myfile.zip
Save the downloaded file to a specific directory:
aria2c -d /path/to/directory http://example.com/myfile.zip
Use a proxy to download the file:
aria2c --http-proxy=http://proxy.example.com:8080 http://example.com/myfile.zip
Resume a previously interrupted download:
aria2c -c http://example.com/myfile.zip
Speed up file allocation, limit upload rate, and stop seeding after the download has finished:
aria2c --file-allocation=trunc --max-upload-limit=100K --seed-time=0 myfile.torrent
Sometimes you may want to download just a few files from a torrent link. First, find the index of the files using this command:
aria2c -S myfile.torrent
After that, you can select the files you need like this:
aria2c --select-file=6-8,10 myfile.torrent
Common command line parameters
-s
: Specifies the number of connections per server (default is 1).--max-download-limit
: Sets a limit on download speed.-d
: Specifies the download directory.-c
: Resumes a previously interrupted download.--http-proxy
: Specifies an HTTP proxy for the download.
Potential problems and pitfalls
When using aria2c
, users may encounter issues such as:
- Network interruptions: Downloads can fail if the internet connection drops.
- Proxy configuration errors: Incorrect proxy settings can prevent downloads.
- File permissions: Ensure that the specified download directory has the necessary permissions.
Common errors and troubleshooting
- If you encounter a "403 Forbidden" error, check the URL for proper access permissions.
- A "File not found" error may indicate an incorrect URL or a deleted file.
- Use
--log-level=debug
for more detailed output when troubleshooting.
Hacks and tricks
- To increase download speed further, consider using
aria2c
with a script to automate downloads from multiple URLs. - Utilize the Metalink format to manage downloads more efficiently.
- Combine
aria2c
withcron
jobs for scheduled downloads, allowing for automated retrieval of files at specified intervals.
Tips and best practices
- Always check the integrity of downloaded files, especially large ones, using checksums if available.
- Use
aria2c
in scripts for automated downloading tasks, which can save time and reduce manual errors. - Regularly update
aria2c
to the latest version for optimal performance and security. - Monitor your downloads and their progress using the
--show-console-readout
option for better visibility during the process.