Download files faster with Axel (with examples)
Introduction:
Axel is a powerful command-line download accelerator that allows users to download files from the internet with improved speed and efficiency. This article will provide code examples to illustrate different use cases of the axel
command.
Use Case 1: Download a URL to a file
To download a URL to a file, use the following command:
axel [URL]
Motivation: This use case is helpful when you want to download a file from a specific URL and save it to your local machine. Axel accelerates the download process, making it faster and more efficient.
Explanation: The command axel
is followed by the URL of the file you want to download. Axel will automatically retrieve the file and save it to your current working directory.
Example Output:
$ axel https://example.com/file.zip
Starting download: https://example.com/file.zip
[ 5%] [> ] 0.00B/s ...
Use Case 2: Download and specify filename
To download a file from a URL and specify the filename, use the following command:
axel [URL] -o [path/to/file]
Motivation: Sometimes, you may want to specify a custom filename for the downloaded file for better organization and ease of access.
Explanation: In this use case, the -o
flag is used to specify the output path and filename. Replace [path/to/file]
with the desired location and name for the saved file.
Example Output:
$ axel https://example.com/file.zip -o ~/Downloads/myfile.zip
Starting download: https://example.com/file.zip
[ 10%] [=======> ] 2.19MiB/s ...
Use Case 3: Download with multiple connections
To download a file using multiple simultaneous connections, use the following command:
axel -n [connections_num] [URL]
Motivation: Downloading files with multiple connections can significantly increase download speeds by utilizing the available bandwidth efficiently.
Explanation: The -n
flag is used to specify the number of concurrent connections to be established during the download. [connections_num]
should be replaced with the desired value.
Example Output:
$ axel -n 8 https://example.com/file.zip
Starting download: https://example.com/file.zip
[ 25%] [==========> ] 10.54MiB/s ...
Use Case 4: Search for mirrors
To search and use available mirrors for downloading a file, use the following command:
axel -S [mirrors_num] [URL]
Motivation: Mirrors are alternative servers that host the same file, allowing for faster downloads by distributing the load across multiple servers.
Explanation: The -S
flag is used to specify the number of mirrors to be searched and used for the download. [mirrors_num]
should be replaced with the desired value.
Example Output:
$ axel -S 3 https://example.com/file.zip
Starting download: https://example.com/file.zip
[100%] [==========================>] 25.01MiB/s ...
Use Case 5: Limit download speed (bytes per second)
To limit the download speed in bytes per second, use the following command:
axel -s [speed] [URL]
Motivation: Limiting the download speed can be useful when you want to avoid saturating your network bandwidth or ensure a fair distribution of bandwidth among other activities.
Explanation: The -s
flag is used to specify the desired maximum speed for downloading the file, in bytes per second. [speed]
should be replaced with the desired value.
Example Output:
$ axel -s 50000 https://example.com/file.zip
Starting download: https://example.com/file.zip
[ 50%] [==============> ] 49.74KiB/s ...
Conclusion:
Axel is a versatile command-line download accelerator that provides various options for optimizing and enhancing the download experience. By using the code examples provided in this article, you can take advantage of Axel’s capabilities to download files faster and more efficiently.