Ubuntu: How to download a file from a website via terminal?



Question:

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

I use axel and wget for downloading from terminal, axel is download accelerator

syntax

axel

Install via the software center

axel www.example.com/example.zip  

wget

wget -c www.example.com/example.zip  

for more details type man axel, man wget in terminal


Solution:3

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


Solution:4

Just to add more flavor to this question, I'd also recommend that you take a look at this:

history -d $((HISTCMD-1)) && echo '[PASSWORD]' | sudo -S shutdown now

You could use this to shutdown your computer after your wget command with a ; perhaps or in a bash script file.

This would mean you don't have to stay awake at night and monitor until your download as (un)successfully run.

Read this answer as well


Solution:5

the lack of Aria2 mention is just a disservice so with that said, check out Aria2. https://aria2.github.io/

Install it by simply typing in terminal:

sudo apt install aria2  

Then simply type this to download the file:

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

You can find more help with aria2 by its man page.


Solution:6

I did these steps From Oh-my-zsh,

brew install wget  wget https://github.com/sencha-extjs-examples/QuickStart/archive/master.zip  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »