When I try to view the zip file with curl the terminal is corrupted. And after that all the character we typed cannot be recognized as they will be shown as unrecognizable Unicode. I curl the zip below:

curl http://udacity.github.io/ud595-shell/stuff.zip

I am asking as I'm curious about this. How is this happening?


When using curl like that, it will output the contents of the Zip-file to the terminal (curl writes to standard output by default). This may well corrupt the terminal, just as when you cat a compressed file or any other binary file.

To save the file, use curl -O .... This will save the file with its original name (stuff.zip) in the current directory.

To save it with another name, use either curl -o newname ... or curl ... >newname.

| improve this answer | |
  • Thanks, as a side question, do we have to close the terminal after it corrupts or retrieve on the runtime? – vusan Mar 14 '17 at 9:54
  • @vusan You could try reset. If that doesn't work, close the terminal and open a new one. – Kusalananda Mar 14 '17 at 9:55
  • reset is working. in my case. – vusan Mar 14 '17 at 9:57
  • When you have a question, "ask a question" is the right place for it, not comments. You will find that your side question has been asked many times here. – JdeBP Mar 14 '17 at 13:33

curl reads the zip file and prints it to stdout. To redirect curls output to a file called stuff.zip you need to state

curl http://udacity.github.io/ud595-shell/stuff.zip -o stuff.zip

-o, --output FILE Write to FILE instead of stdout

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.