linuxhttpurlcommand

Is it possible to read only first N bytes from the HTTP server using Linux command?


Given the url http://www.example.com, can we read the first N bytes out of the page?

So, how can we read the first N bytes from the HTTP server in practice?


Solution

  • curl <url> | head -c 499
    

    or

    curl <url> | dd bs=1 count=499
    

    should do

    Also there are simpler utils with perhaps broader availability like

        netcat host 80 <<"HERE" | dd count=499 of=output.fragment
    GET /urlpath/query?string=more&bloddy=stuff
    
    HERE
    

    Or

    GET /urlpath/query?string=more&bloddy=stuff