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


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


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


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

doesn't work ;)


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.


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



Install via the software center

axel www.example.com/example.zip  


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

for more details type man axel, man wget in terminal


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


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


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.


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
Next Post »