Command-Line – How to Download a File from a Website via Terminal

command lineurl

Suppose that we have a full URL of desired file e.g.

http://domain.com/directory/4?action=AttachFile&do=view&target=file.tgz

I would like to go without installing a new software. Is it possible?

Command

 cp  'http://example.com/directory/4?action=AttachFile&do=get&target=file.tgz' hooray

doesn't work 😉

Best Answer

Open terminal and type

wget "http://domain.com/directory/4?action=AttachFile&do=view&target=file.tgz" 

to download the file to the current directory.

wget  -P /home/omio/Desktop/ "http://thecanadiantestbox.x10.mx/CC.zip"

will download the file to /home/omio/Desktop

wget  -O /home/omio/Desktop/NewFileName "http://thecanadiantestbox.x10.mx/CC.zip"

will download the file to /home/omio/Desktop and give it your NewFileName name.

Related Question