How to download a file from a website via terminal?
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 ;)
Solution 1:
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.
Solution 2:
you can do it by using curl .
curl -O http://domain.com/directory/4?action=AttachFile&do=view&target=file.tgz
The -O saves the file with the same name as in the url rather than dumping the output to stdout
For more information