Linux – Why did wget download to the home directory (Linux) rather than the specified directory

linux

I ran the wget command via the terminal for the very first time(linux newbie) and rather than downloading the file to the path I specified i.e. wget {URI} /home/{username}/Downloads but it downloaded the file to the path /home/. Why is that? Also why do I get the message /home/{username}/Downloads/: Scheme missing.

Best Answer

wget doesn't work like this. It needs the -O (read: capital O) parameter if you want to supply a different output file name.

wget -O [output-file] [URI] 

Note that according to man wget:

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.

So this only works in simple cases where you have one file to download.

Related Question