How to accelerate file downloads in Linux terminal

Large terminal downloads such as ISO images, release tarballs, and backup archives can take longer than necessary when the remote host feeds the file through only one transfer stream. Opening several byte-range requests against the same file can shorten that wait when the link still has unused bandwidth and the mirror allows partial downloads.

Axel is a lightweight command-line download accelerator that opens several HTTP, HTTPS, FTP, or FTPS connections to the same file and writes those ranges into one output file. When the server honors byte ranges, each connection pulls a different section, which is what allows the transfer to finish sooner than a single-stream download.

The examples below assume Axel is already installed and that the source provides a direct file URL rather than a release page or HTML redirect. Start with 4 or fewer connections, because some mirrors rate-limit or refuse larger fan-out, and a range probe that returns 200 OK instead of 206 Partial Content usually means there is no real acceleration available for that file.

Steps to accelerate file downloads with Axel in Linux terminal:

  1. Copy the direct file URL from the browser, release page, or mirror index.

    Axel needs the real file URL, not the surrounding HTML page. A usable link usually ends with the archive, package, or image filename.

  2. Probe the remote file with a one-byte range request before starting the accelerated transfer.
    $ curl -sS -D - -o /dev/null -r 0-0 https://downloads.example.net/releases/toolkit-linux-amd64.tar.xz
    HTTP/1.1 206 Partial Content
    Server: nginx
    Content-Type: application/octet-stream
    Content-Length: 1
    Content-Range: bytes 0-0/1048576

    206 Partial Content plus Content-Range confirms that the server returned a real byte range, which is the behavior Axel needs for multi-connection downloads.

    If the response is 200 OK instead, or Content-Range never appears, Axel usually falls back to one connection and reports Server unsupported, starting from scratch with one connection.

  3. Start the accelerated download with a small number of parallel connections and an explicit output filename.
    $ axel --num-connections=4 --output toolkit-linux-amd64.tar.xz https://downloads.example.net/releases/toolkit-linux-amd64.tar.xz
    Initializing download: https://downloads.example.net/releases/toolkit-linux-amd64.tar.xz
    File size: 1 Megabyte(s) (1048576 bytes)
    Opening output file toolkit-linux-amd64.tar.xz
    Starting download
    
    [  0%]  .......... .......... .......... .......... ..........  [  35.1KB/s]
    ##### snipped #####
    Downloaded 1 Megabyte(s) in 3 second(s). (319.77 KB/s)

    Start with 4 or fewer connections unless the mirror explicitly allows more. Small fan-out is usually enough to improve throughput without creating unnecessary load on a shared download host.

  4. Confirm that the finished file length matches the total size advertised by the range probe before treating the download as complete.
    $ wc -c toolkit-linux-amd64.tar.xz
    1048576 toolkit-linux-amd64.tar.xz

    The number after the slash in the earlier Content-Range value is the full remote object length. Matching that total against wc -c confirms that the local file reached the same byte count.

    If throughput gets worse or the mirror starts resetting connections, rerun the same command with a lower --num-connections value such as 2.