0

I use this curl command to download a setup.exe :

curl -k -u login:Password -O "https://url/to/my/setup.exe"

I want to get the time total :

curl -s -w 'total : %{time_total}\n' -k -u login:Password -O "https://url/to/my/setup.exe"
total : 41.165108

I want to redirect the output ( total : 41.165108 ) in an external file. I try :

curl -o test.txt -s -w 'total : %{time_total}\n' -k -u login:Password -O "https://url/to/my/setup.exe"
curl -s -w 'total : %{time_total}\n' -k -u login:Password -O "https://url/to/my/setup.exe" > test.txt

But it doesn't work...

Someone to show me ?

Thanks !

1
  • Have you tried >test.txt as part of the command line? the -w option goes to stdout, you're redirecting the data output with the -O option Commented Jan 11, 2021 at 10:52

2 Answers 2

1

Just combine the two things you've tried:

curl -s -w 'total : %{time_total}\n' -k -u login:Password \
    -O "https://url/to/my/setup.exe" -o setup.exe > total.txt
#                                    ~~~~~~~~~~~~ ~~~~~~~~~~~
  • setup.exe will contain the downloaded file
  • total.txt will contain the total

The -o doesn't influence where the output of -w goes.

Sign up to request clarification or add additional context in comments.

Comments

0

The -o parameter is in lowercase, and the file to output to, is to be entered after the parameter, an example is below,

curl -K myconfig.txt -o output.txt

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.