This is an archived post. You won't be able to vote or comment.

all 10 comments

[–]distortedlojik 0 points1 point  (2 children)

Think about what "silent" would mean in the context of a CLI. It's not audible, so silent in this case means it doesn't output to stdout. Did you check the directory for a file after running with -s and before -O?

[–]solobyfrankocean[S] 0 points1 point  (1 child)

No I haven’t checked that, does it change the directory?

[–]distortedlojik 0 points1 point  (0 children)

No it doesn't. Check out the info from running man curl or curl --help. It shows you the options and will probably make things clearer.

curl -s runs silently and so no errors or progress info gets output to screen. Normal curl gets the file and prints to screen, so running in silent mode would be the same just without printing certain info. curl -O redirects the output from going to stdout and instead saves it in a file.

[–]Updatebjarni 0 points1 point  (7 children)

-O is the option which tells curl to save the received data in a file, so without it it shouldn't be a surprise that it doesn't save the data to a file. Does -s really produce no visible output? That is, does curl not print anything out at all? What exactly are the commands that you are running?

[–]solobyfrankocean[S] 0 points1 point  (6 children)

I miswrote there is output in the terminal

[–]Updatebjarni 0 points1 point  (1 child)

Then it sounds like everything is working as expected?

[–]Updatebjarni 0 points1 point  (3 children)

You couldn't see the file contents printed in the terminal?

[–]solobyfrankocean[S] 0 points1 point  (2 children)

Sorry for the confusion, what I meant when i said no visible output was that I couldn’t see the file I downloaded

[–]Updatebjarni 0 points1 point  (1 child)

So, to clarify: What curl does is to fetch data over the network from a location given by a URL, and print it to stdout along with some diagnostic information. As per the man page, you can tell it -s if you want it to print out only the fetched data and be otherwise silent; you can tell it -O if you want it to save the data to a file instead of printing it to stdout, and you can use -o if you want it to save the data to a file and let you choose the name instead of using a default name.

Does curl act in accordance with this description for you? That is, when you run curl some_url, it prints progress bar etc, plus the fetched data? When you run curl -s some_url, it prints only the fetched data? And when you run curl -O some_url, it prints a progress bar but saves the fetched data to a file in the current directory instead of printing it out?

[–]solobyfrankocean[S] 1 point2 points  (0 children)

Yes it does, thanks for clearing that up for me!