Manas Chaturvedi Manas Chaturvedi - 1 year ago 94
Linux Question

Ubuntu: Using curl to download an image

I want to download an image accessible from this link:
into my local system. Now, I'm aware that the
command can be used to download remote files through the terminal. So, I entered the following in my terminal in order to download the image into my local system:


However, this doesn't seem to work, so obviously there is some other way to download images from the Internet using
. What is the correct way to download images using this command?

Answer Source

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

You will receive binary data:

                   |�>�$! <R�HP@T*�Pm�Z��jU֖��ZP+UAUQ@�
��{X\� K���>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 > image.png

to store that raw image data inside of a file.

An easier way though, is just to use wget.

$ wget
$ ls
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download