Ubuntu: Using curl to download an image

前端 未结 5 1754
隐瞒了意图╮
隐瞒了意图╮ 2021-01-31 01:17

I want to download an image accessible from this link: https://www.python.org/static/apple-touch-icon-144x144-precomposed.png into my local system. Now, I\'m aware

5条回答
  •  不要未来只要你来
    2021-01-31 01:53

    curl without any options will perform a GET request. It will simply return the data from the URI specified. Not retrieve the file itself to your local machine.

    When you do,

    $ curl https://www.python.org/static/apple-touch-icon-144x144-precomposed.png
    

    You will receive binary data:

                       |�>�$! 0c�yF[i�}4�!�V̧�H_�)nO#�;I��vg^_ ��-Hm$$N0.
    ���%Y[�L�U3�_^9��P�T�0'u8�l�4 ...
    

    In order to save this, you can use:

    $ curl https://www.python.org/static/apple-touch-icon-144x144-precomposed.png > image.png
    

    to store that raw image data inside of a file.

    An easier way though, is just to use wget.

    $ wget https://www.python.org/static/apple-touch-icon-144x144-precomposed.png
    $ ls
    .
    ..
    apple-touch-icon-144x144-precomposed.png
    

提交回复
热议问题