Linux How To Download File From URL
If you are reading this you probably want to learn how to download files from a URL using Linux. We are going to go ahead and assume that you want to do this from the command line and not from a browser because otherwise you probably wouldn’t be searching for this. The good news is that this is very easy.
Quick Answer - Example, just do this:
You can download a file from a URL from the Linux command line using one of these tools:
These aren’t the only tools that you can use but they are two of the most common.
You can download a file with wget like this:
You can also specify the filename that you want to save the file to on your system:
wget http://example.com/data.tar.gz -O mydatafile.tar.gz wget http://example.com/data.tar.gz -O /home/user1/data.tar.gz
You can download using curl too but by default it just outputs to stdout ( right on your screen ). This is great for an HTML file but not for a gzipped archive.
You can tell curl to download to a file instead like this:
curl http://example.com/data.tar.gz data.tar.gz
Install Curl and Wget on Ubuntu
You should probably have both of these commands installed already but if you don’t for whatever reason you can just install them like this.
sudo apt update sudo apt install curl
sudo apt update apt install wget