2

I tried the following :

[$] wget http://cdn.edgecast.steamstatic.com/steam/apps/256679148/movie480.webm > Conan1.webm 
                                                    [1:21:05]
--2017-02-23 01:51:50--  http://cdn.edgecast.steamstatic.com/steam/apps/256679148/movie480.webm
Resolving cdn.edgecast.steamstatic.com (cdn.edgecast.steamstatic.com)... 117.18.232.131
Connecting to cdn.edgecast.steamstatic.com (cdn.edgecast.steamstatic.com)|117.18.232.131|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11255413 (11M) [video/webm]
Saving to: ‘movie480.webm’

movie480.webm                       100%[===================================================================>]  10.73M  33.7KB/s    in 6m 25s  

2017-02-23 01:58:16 (28.6 KB/s) - ‘movie480.webm’ saved [11255413/11255413]

As can be seen the first part of the command worked, wget downloaded the file but the second part of the command that renaming the file, in this case a very generic movie480.webm was downloaded. Why wasn't conan1.webm , the name I had suggested it took.

I do know that if I had done -

$ mv  movie480.webm conan1.webm 

then it would work, but this means an additional command. Why that failed ? Could there have been another way to do the same thing in a single command though similar to shown above?

2 Answers 2

9

You didn't "suggest it took" the name Conan1.webm, you redirected its standard output stream to file called Conan1.webm. Since wget doesn't write to standard output by default, that has no effect on where the content is saved.

See man wget - in particular the -O option:

-O file
--output-document=file
    The documents will not be written to the appropriate files, but all
    will be concatenated together and written to file.  If - is used as
    file, documents will be printed to standard output, disabling link
    conversion.  (Use ./- to print to a file literally named -.)

So you could have used

wget -O Conan1.webm http://cdn.edgecast.steamstatic.com/steam/apps/256679148/movie480.webm 

or

wget -O- http://cdn.edgecast.steamstatic.com/steam/apps/256679148/movie480.webm > Conan1.webm 
0

Change the > symbol to -O. > is used to redirect the text that the command normally prints to the screen (only its stdout, to be more accurate) to a file. A file created with > contains the text normally printed to the screen.

1
  • 2
    It's kind of the shell output; it's really wget's stdout output, which would follow the shell's stdout.
    – Jeff Schaller
    Feb 23, 2017 at 1:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .