Live data from Hacker News

Curl vs. Wget

daniel.haxx.se

11–20 of 205 posts

Re: Curl vs. Wget

#12
post #2

"Wget can be typed in using only the left hand on a qwerty keyboard!" I love both of these, but wish that curl was just like wget in that the default behavior was to download a file, as opposed to pipe it to stdout. (Yes, aliases can help, I know.)

Streaming to stdout is more Unix-y, allowing you to pipe the response into further processes. For example: curl http://api.example.com/json | jq '.["someKey"]' # etc., etc.

Fair enough. Perhaps I just need to adjust my expectations.

Or maybe there's a good reason for having two tools :)

Re: Curl vs. Wget

#13
Also putting this out there—for nicer REST API interaction on the CLI, and a little more user-friendliness, you might also want to add HTTPie[1] to your toolbelt.

It's not going to replace curl or wget usage, but it is a nicer interface in certain circumstances.

[1] https://github.com/jkbrzt/httpie

Re: Curl vs. Wget

#14
post #10
post #7

Earlier quoted context omitted.

I use wget for downloads because it follows links by default and resume is just -c. I never figured out how to make curl do the equivalent of -c.

I don't think you can: "[Wget's] ability to recover from a prematurely broken transfer and continue downloading has no counterpart in curl."

    curl -C - -O filename url
-C continues from an offset; "-C -" uses the length of the output file as the offset.

Re: Curl vs. Wget

#16
post #7
post #3

I instinctively go to `wget` when I need to, uhm, get the file into my computer[1]. `curl -O` is a lot more effort :P Other than that, curl is always better. [1] Aliasing `wget` to ~`curl -O` might be a good idea :)

I use wget for downloads because it follows links by default and resume is just -c. I never figured out how to make curl do the equivalent of -c.

Lets compare the length of the man page:

    $ man curl | wc -l
    1728
    $ man wget | wc -l
    1096
How about the --help output?

    $ curl --help | wc -l
    178
    $ wget --help | wc -l
    176
The wget help is nicer, grouping options together by category and with longer text. curl just has a long list of options in alphabetical order. How many (long) options do they have?

    $ curl --help | grep -- -- | wc -l
    175
    $ wget --help | grep -- -- | wc -l
    137
I'd say it is a lot quicker to work out the flags etc you need with wget because there is less to look through.

Re: Curl vs. Wget

#17
post #2

"Wget can be typed in using only the left hand on a qwerty keyboard!" I love both of these, but wish that curl was just like wget in that the default behavior was to download a file, as opposed to pipe it to stdout. (Yes, aliases can help, I know.)

Streaming to stdout is more Unix-y, allowing you to pipe the response into further processes. For example: curl http://api.example.com/json | jq '.["someKey"]' # etc., etc.

Or in modern idiomatically insecure install scripts:

    curl http://bogus.example.com/install | sudo bash

Re: Curl vs. Wget

#18
post #7

Earlier quoted context omitted.

I use wget for downloads because it follows links by default and resume is just -c. I never figured out how to make curl do the equivalent of -c.

Lets compare the length of the man page: $ man curl | wc -l 1728 $ man wget | wc -l 1096 How about the --help output? $ curl --help | wc -l 178 $ wget --help | wc -l 176 The wget help is nicer, grouping options together by category and with longer text. curl just has a long list of options in alphabetical order. How many (long) options do they have? $ curl --help | grep -- -- | wc -l 175 $ wget --help | grep -- -- |…

"I'm glad I typed `man wget` instead of `wget --help`" -- no one ever

You want the `wget --help` text over the man page, 99% of the time. The other 1%, you want the full info manual. The man page is an awful mix between the two; too dense for scanning through for the flag you need, but not containing the full information when you need specifics.

Re: Curl vs. Wget

#19
post #2

"Wget can be typed in using only the left hand on a qwerty keyboard!" I love both of these, but wish that curl was just like wget in that the default behavior was to download a file, as opposed to pipe it to stdout. (Yes, aliases can help, I know.)

Streaming to stdout is more Unix-y, allowing you to pipe the response into further processes. For example: curl http://api.example.com/json | jq '.["someKey"]' # etc., etc.

It may be more unix-y, but it's less user-friendly if the expectation is to just download a file.

EDIT: Wow, surprised by the downvotes. I don't think I said anything controversial (y'know principle of least surprise and all), but maybe I was being a bit too opaque: wget, by virtue of being the first on the scene, built an expectation that $THING_THAT_GETS_URLS would result in a file without any other input/arguments. Curl, to this day, surprises me because I was around when wget was all you had.

Re: Curl vs. Wget

#20
post #6

Curl scripts allow open connection to view all new logs in a session. can wget do similar? I did not know it can or could however from my point of view if it cannot this is like comparing a philips head screwdriver to a powertool with 500pc set.

What do you even mean by logs in a session?
Post reply on HN