Is there a unix command I can use to pull a file from a URL and put it into a directory of my choice? So I have a URL which if you go to it, a file will be downloaded. I want to be able to type a unix command to download the linked file from the URL I specify and place it into a directory of my choice.

So if the URL www.example.com/image.png. I want to type a unix command to download the image.png file, I want to put that file into my examples/ directory

Is this possible?


  • I've tried curl and wget as suggested; however, I do not believe the file is finishing downloading. The file I am attempting to download is a .apk (android app) Thanks for all suggestions so far – Corey Jun 14 '11 at 21:37
  • Both curl and wget provide progress indication for downloads. – Brandon E Taylor Jun 14 '11 at 21:49
  • Yes they do and they say 100%; however, I don't think it is correct. try for yourself. I am using the following URL to test: http://www.freewarelovers.com/android/download/temp/1280424320_ASTRO_File_Manager_2.5.2.apk First try with both curl and wget then go to the URL directly and compare the results – Corey Jun 14 '11 at 21:51
  • And I've also got an error when trying wget Connecting to www.freewarelovers.com||:80... connected. HTTP request sent, awaiting response... No data received. Retrying. – Corey Jun 14 '11 at 21:55
  • I suspect the freewarelovers site has set things up such that you cannot directly download the resource using the URL you provided. – Brandon E Taylor Jun 14 '11 at 22:02
wget -P examples/ www.example.com/image.png


curl -o examples/image.png www.example.com/image.png

both work.

| improve this answer | |

Meet your new friend, wget:

wget -O examples/image.png www.example.com/image.png


man wget

for more usage details.

| improve this answer | |

as mentioned before, wget is your tool of choice.

If The site is protected with a password (HTTP Basic Auth), wget will give you an HTTP 401 Unauthorized, if you don't provide a user and password. Use this to provide a username and password.

wget --http-user=<username> --http-password=<Secretpassword> <yourURL>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy