Download files from the command line in Linux

There are man times when you will have to download files from the command line. In most distributions, you have two tools – wget and curl.


This a very powerful command to simply download a file. Just use wget URL to download the file to the current location:

root@web [/]# wget
--2020-01-19 06:11:50--
Resolving (
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 94371840 (90M)
Saving to: 'test'

100%[==============================================================================================================================>] 94,371,840  11.2MB/s   in 8.3s

2020-01-19 06:11:58 (10.9 MB/s) - 'test' saved [94371840/94371840]

root@web [/]#

To use a custom filename, the command is wget URL -O filename.


With the curl command, you can get the file content or download a file. To get file content, use curl URL:

root@web [~]# curl

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<TITLE>Test file</TITLE>

<BODY bgcolor="#EFEFEF">
Testing ...
root@web [~]#

To download a file, curl URL -o filename

root@web [/]# curl -o test_file
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 90.0M  100 90.0M    0     0  10.5M      0  0:00:08  0:00:08 --:--:-- 11.1M
root@web [/]#

wget man page
curl man page