How to get remote file size from a shell script?
Is there a way to get the size of a remote file like http://api.twitter.com/1/statuses/public_timeline.json in shell script? codaddict You can download the file and get its size. But we can do better. Use curl to get only the response header using the -I option. In the response header look for Content-Length: which will be followed by the size of the file in bytes. $ URL="http://api.twitter.com/1/statuses/public_timeline.json" $ curl -sI $URL | grep -i Content-Length Content-Length: 134 To get the size use a filter to extract the numeric part from the output above: $ curl -sI $URL | grep -i