Byte-range downloads are useful when only one section of a remote object is needed for validation, header inspection, binary probing, or resume preparation. Pulling only the required slice avoids re-downloading a full archive, package, disk image, or media asset when the next task depends on a known offset or trailer.
cURL requests partial content with --range or its short form -r. For HTTP transfers, the request maps to the Range header, where byte offsets start at zero and the end offset is inclusive, so 0-99 requests exactly 100 bytes when the server honors it. Open-ended syntax such as 1024- starts at an offset and continues to EOF, while suffix syntax such as -128 requests the final 128 bytes.
Range support is not guaranteed. A compliant server returns 206 Partial Content with Content-Range, a server that ignores the request often returns the full object with 200 OK, and invalid offsets can trigger 416 Range Not Satisfiable. Confirm both the saved size and the response headers before treating the fragment as valid input for another tool or pipeline.
Related: How to resume a download with cURL
Related: How to save cURL output to a file
Steps to download a specific byte range with cURL:
- Request the first 100 bytes and save them to a dedicated local file.
$ curl -sS -r 0-99 -o ops-agent.head-100.bin https://downloads.example.net/releases/ops-agent-2026.03.tar.gz
-r is the short form of --range. Because the end offset is inclusive, 0-99 always targets 100 bytes.
- Confirm the saved chunk size before using it downstream.
$ wc -c ops-agent.head-100.bin 100 ops-agent.head-100.bin
Byte counts that do not match the requested interval usually mean the server ignored the range, the target changed, or the output file was reused accidentally.
- Request everything from a starting offset onward when the tail of the file matters more than the exact end byte.
$ curl -sS -r 1024- -o ops-agent.from-1024.bin https://downloads.example.net/releases/ops-agent-2026.03.tar.gz
Open-ended syntax like 1024- starts at the specified byte offset and continues until the remote object ends.
- Request the final bytes with a suffix range when only the trailer is needed.
$ curl -sS -r -128 -o ops-agent.tail-128.bin https://downloads.example.net/releases/ops-agent-2026.03.tar.gz $ wc -c ops-agent.tail-128.bin 128 ops-agent.tail-128.bin
Suffix syntax like -128 asks for the last 128 bytes without needing the total object size in advance.
- Capture the response headers when the transfer needs proof that the server honored the requested range.
$ curl -sS -D range-headers.txt -o /dev/null -r 0-99 https://downloads.example.net/releases/ops-agent-2026.03.tar.gz $ grep -Ei '^(HTTP/|accept-ranges:|content-range:|content-length:)' range-headers.txt HTTP/2 206 accept-ranges: bytes content-range: bytes 0-99/52428800 content-length: 100
206 Partial Content plus Content-Range confirms that the server returned only the requested bytes instead of the full file.
If the status is 200 OK and Content-Range is missing, the server ignored the byte range and returned the full object. If the status is 416 Range Not Satisfiable, reduce the offset or confirm the remote file size before retrying.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
