If you want to know what is the size of an HTTP/HTTPS request response-payload, you need to look at the content-length header from the response headers.
Example:% curl -sI "https://code.jquery.com/jquery-3.5.0.min.js"
HTTP/2 200
date: Wed, 30 Nov 2022 12:02:51 GMT
content-length: 89493
content-type: application/javascript; charset=utf-8
last-modified: Fri, 20 Aug 2021 17:47:53 GMT
accept-ranges: bytes
server: nginx
etag: W/"611feac9-15d95"
cache-control: max-age=315360000
cache-control: public
access-control-allow-origin: *
vary: Accept-Encoding
x-hw: 1669809771.dop244.fr8.t,1669809771.cds237.fr8.hn,1669809771.cds139.fr8.c
You can pipe it with grep command to just get the size of the response in bytes.
Exmple:% curl -sI "https://code.jquery.com/jquery-3.5.0.min.js" | grep content-length
content-length: 89493
Note: The way Content-Lenght is displayed in the HTTP response may differ in upper-lowercase, so it's better to make use of case-insensitivity options with grep.
% curl -sI "https://code.jquery.com/jquery-3.5.0.min.js" | grep -iF 'content-length'
content-length: 89493

-
Facing issues? Have Questions? Post them here! I am happy to answer!
More Posts related to cURL,
- cURL Option to show HTTP Response Status Code
- URL Encode cURL HTTP GET\POST Data with Examples
- Capture cURL Request Output to a File
- Fix: Curl No Match Found Error
- trurl: A new command-line tool for URL parsing and manipulation by cURL Developer
- Send JSON Data as Payload using cURL HTTP POST Request
- cURL: Show Request and Response Headers
- Get cURL command from Chrome Inspect Network HTTP URL
- Save cURL Command Output to a external file
- cURL DELETE Request with Examples
- How to URL Encode Data for a cURL Request Parameters
- cURL Example using IP (IPv4 and IPv6) address and Port
- How to convert a Postman request to cURL Command
- [fix] command not found curl
- How to Pretty Print cURL JSON Output in Terminal
- How to follow redirects in cURL Command Request
- How to pass authorization header using cURL
- cURL -x Use of HTTP Proxy Server Examples
- Downloading Google Chrome using cURL Command
- How to get cURL Command to run in verbose mode?
- List of 28 Protocols supported by cURL with Examples
- Hide cURL Outputs and Errors on Terminal
- cURL -d Option with Examples
- How to show SSL Certificate details using cURL Command
- Perform Basic Authentication using cURL with Examples
More Posts:
- pwd Command - Print Working Directory - Linux
- Failed to load the JNI shared library jvm.dll - Eclipse
- Python Regular Expression to Find All Matches in List - Python
- Fix Python WARNING: You are using pip version 19 however version 21 is available - PIP
- Convert Multidimensional Array toString In Java - Java
- How to view the desktop when using macOS Stage Manager? - MacOS
- Create RabbitMQ Exchange using Java Spring Boot Example - Java
- Compare Current and Previous Versions of Same File (Local History) in Eclipse - Eclipse