How to use the command aria2c (with examples)

How to use the command aria2c (with examples)

Aria2c is a fast download utility that supports various protocols such as HTTP(S), FTP, SFTP, BitTorrent, and Metalink. It provides flexibility in downloading files, allowing users to customize their download options according to their needs. Here are some examples of how to use the aria2c command:

Use case 1: Download a specific URI to a file

Code:

aria2c "url"

Motivation: This use case is useful when you want to download a specific file from a URL. By providing the URL as an argument to aria2c, the command will start downloading the file to the current directory.

Explanation:

  • url: Specifies the URL of the file you want to download.

Example output:

02/11 15:28:26 [NOTICE] Downloading 1 item(s)
...
...
02/11 15:28:45 [NOTICE] Download complete: /path/to/downloaded/file

Use case 2: Download a file from a URI with a specific output name

Code:

aria2c --out=path/to/file "url"

Motivation: Sometimes, you may want to specify a specific name for the downloaded file. This use case allows you to choose the output name by using the --out option.

Explanation:

  • --out=path/to/file: Specifies the output path and filename for the downloaded file.
  • url: Specifies the URL of the file you want to download.

Example output:

02/11 15:30:10 [NOTICE] Downloading 1 item(s)
...
...
02/11 15:30:45 [NOTICE] Download complete: path/to/file

Use case 3: Download multiple different files in parallel

Code:

aria2c --force-sequential=false "url1 url2 ..."

Motivation: When you have multiple files to download, you can use this use case to download them in parallel. By default, aria2c downloads files sequentially, but by setting --force-sequential to false, you can enable parallel downloads.

Explanation:

  • --force-sequential=false: Allows parallel downloading of multiple files.
  • "url1 url2 ...": Specifies multiple URLs of files you want to download.

Example output:

02/11 15:32:20 [NOTICE] Downloading 2 item(s)
...
...
02/11 15:32:45 [NOTICE] Download complete: /path/to/downloaded/file1
02/11 15:33:00 [NOTICE] Download complete: /path/to/downloaded/file2

Use case 4: Download from multiple sources with each URI pointing to the same file

Code:

aria2c "url1 url2 ..."

Motivation: If you have multiple sources for the same file, this use case allows you to download it simultaneously from different sources. This can improve download speed and reliability.

Explanation:

  • "url1 url2 ...": Specifies multiple URLs of files you want to download. The same file will be downloaded from each URL.

Example output:

02/11 15:34:10 [NOTICE] Downloading 2 item(s)
...
...
02/11 15:34:45 [NOTICE] Download complete: /path/to/downloaded/file

Use case 5: Download the URIs listed in a file with a specific number of parallel downloads

Code:

aria2c --input-file=path/to/file --max-concurrent-downloads=number_of_downloads

Motivation: When you have a file that contains a list of URLs and you want to download them concurrently with a specific number of parallel downloads, this use case is helpful.

Explanation:

  • --input-file=path/to/file: Specifies the file that contains URLs to be downloaded.
  • --max-concurrent-downloads=number_of_downloads: Limits the number of concurrent downloads.

Example output:

02/11 15:36:20 [NOTICE] Downloading 2 item(s)
...
...
02/11 15:36:45 [NOTICE] Download complete: /path/to/downloaded/file1
02/11 15:36:50 [NOTICE] Download complete: /path/to/downloaded/file2

Use case 6: Download with multiple connections

Code:

aria2c --split=number_of_connections "url"

Motivation: To accelerate the download speed, using multiple connections can be beneficial. This use case allows you to specify the number of connections for downloading a file.

Explanation:

  • --split=number_of_connections: Specifies the number of connections for downloading the file.
  • "url": Specifies the URL of the file you want to download.

Example output:

02/11 15:38:10 [NOTICE] Downloading 1 item(s)
...
...
02/11 15:38:45 [NOTICE] Download complete: /path/to/downloaded/file

Use case 7: FTP download with username and password

Code:

aria2c --ftp-user=username --ftp-passwd=password "url"

Motivation: Some FTP servers require authentication to access files. This use case allows you to provide a username and password to download files from an FTP server that requires authentication.

Explanation:

  • --ftp-user=username: Specifies the FTP username for authentication.
  • --ftp-passwd=password: Specifies the FTP password for authentication.
  • "url": Specifies the FTP URL of the file you want to download.

Example output:

02/11 15:40:10 [NOTICE] Downloading 1 item(s)
...
...
02/11 15:40:45 [NOTICE] Download complete: /path/to/downloaded/file

Use case 8: Limit download speed in bytes/s

Code:

aria2c --max-download-limit=speed "url"

Motivation: In some situations, it may be necessary to limit the download speed to avoid overwhelming the network or to allocate bandwidth for other tasks. This use case allows you to set a maximum download speed in bytes per second.

Explanation:

  • --max-download-limit=speed: Specifies the maximum download speed in bytes per second.
  • "url": Specifies the URL of the file you want to download.

Example output:

02/11 15:42:10 [NOTICE] Downloading 1 item(s)
...
...
02/11 15:42:45 [NOTICE] Download complete: /path/to/downloaded/file

Conclusion

The aria2c command is a versatile utility for fast and efficient downloads. It supports various protocols and provides a wide range of options to customize the download process. Whether you need to download specific files, download in parallel, or limit download speed, aria2c can fulfill your requirements.

Related Posts

Advanced Powerlevel10k Configuration (with examples)

Advanced Powerlevel10k Configuration (with examples)

Introduction Powerlevel10k is a highly customizable theme for the Zsh shell that provides a beautiful and informative prompt.

Read More
How to use the command 'pipx' (with examples)

How to use the command 'pipx' (with examples)

This article provides examples of using the command ‘pipx’, which is a tool used to install and run Python applications in isolated environments.

Read More
qm destroy (with examples)

qm destroy (with examples)

QEMU/KVM Virtual Machine Manager is a powerful tool for managing virtual machines in Proxmox VE.

Read More