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

前端 未结 5 1426
梦如初夏
梦如初夏 2020-12-14 16:52

Here is the question.

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

  • using wget, we can
5条回答
  •  孤城傲影
    2020-12-14 17:46

    curl  | head -c 499
    

    or

    curl  | dd bs=1 count=499
    

    should do

    Also there are simpler utils with perhaps borader 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
    

提交回复
热议问题