Commands.page Logo

How to Check File Size With Aria2 Headers on Ubuntu

This guide explains how to use the aria2 command-line utility on Ubuntu to retrieve HTTP headers without downloading the entire file. By issuing a HEAD request, you can verify the remote file size and connection details before committing to a download.

The Command to Download Headers Only

To check the file size without downloading the content, use the --head option with the aria2c command. This sends a HEAD request to the server, which returns the metadata including the Content-Length header.

Run the following command in your terminal:

aria2c --head <URL>

Replace <URL> with the direct link to the file you wish to inspect.

Example Usage

Here is a practical example using a sample file link:

aria2c --head https://example.com/large-file.zip

Upon execution, aria2 will connect to the server and display the response headers. Look for the Content-Length field in the output. This value represents the size of the file in bytes.

Installing Aria2 on Ubuntu

If you do not have aria2 installed on your system, you can install it using the APT package manager. Open your terminal and run:

sudo apt update
sudo apt install aria2

Once installed, the --head command will be available for immediate use.