- How to Download a File on Ubuntu Linux using the Command Line
- Download files using Curl
- Install curl
- Download and save the file using the source file name
- Download and save the file with a different name
- Download multiple files
- Download files from an FTP Server
- Pause and resume download
- Download files using Wget
- Install wget
- Download file or webpage using wget
- Download files with a different name
- Download files through FTP
- Recursively download files
- Download multiple files
- Pause and Resume download
- Karim Buzdar
- 5 Linux Command Line Based Tools for Downloading Files and Browsing Websites
- 1. rTorrent
- Installation of rTorrent
- 2. Wget
- Installation of Wget
- 3. cURL
- Installation of cURL
- 4. w3m
- Installation of w3m
- 5. Elinks
- Installation of Elinks
- If You Appreciate What We Do Here On TecMint, You Should Consider:
- Copy Files Between Windows and Linux Using Command Line
- Copy File from Windows To Linux
- Copy File From Linux To Windows
How to Download a File on Ubuntu Linux using the Command Line
Linux Command line offers more flexibility and control than GUI. A number of people prefer to use the command line than GUI because it is easier and quicker to use than GUI. Using the command line, it is easier to automate the tasks using one line. In addition, it utilizes fewer resources than GUI.
Downloading files is a routine task that is normally performed every day that can include file types like ZIP, TAR, ISO, PNG, etc. you can simply and quickly perform this task using the command line terminal. It requires only using your keyboard. So today, I will show you how you can download a file using the command line in Linux. There are normally two known ways to do this, that is using wget and curl utility. For this article, I am using Ubuntu 20.04 LTS for describing the procedure. But the same commands will work on other Linux distributions like Debian, Gentoo, and CentOS too.
Download files using Curl
Curl can be used to transfer data over a number of protocols. It supports many protocols including HTTP, HTTPS, FTP, TFTP, TELNET, SCP, etc. using Curl, you can download any remote files. It supports pause and resumes functions as well.
To get started with, first, you need to install the curl.
Install curl
Launch command line application in Ubuntu that is Terminal by pressing the Ctrl+Alt+T key combinations. Then enter the below command to install curl with sudo.
When prompted for a password, enter sudo password.
Once the installation is complete, enter the below command to download a file.
Download and save the file using the source file name
To save the file with the same name as the original source file on the remote server, use –O (uppercase O) followed by curl as below:
Instead of -O, you can also specify, “–remote-name” as shown below. Both work the same.
Download and save the file with a different name
If you want to download the file and save it in a different name than the name of the file in the remote server, use -o (lower-case o) as shown below. This is helpful when the remote URL doesn’t contain the file name in the URL as shown in the example below. Advertisement
[filename] is the new name of the output file.
Download multiple files
To download multiple files, enter the command in the following syntax:
Download files from an FTP Server
To download a file from FTP server, enter the command in following syntax:
To download files from user authenticated FTP servers, use the following syntax:
Pause and resume download
While downloading a file, you can manually pause it using Ctrl+C or sometimes it automatically gets interrupted and stopped due to any reason, you can resume it. Navigate to the same directory where you have previously downloaded the file then enter the command in the following syntax:
Download files using Wget
Using wget, you can download files and contents from Web and FTP servers. Wget is a combination of www and the get. It supports protocols like FTP, SFTP, HTTP, and HTTPS. Also it supports recursive download feature. This feature is very useful if you want to download an entire website for offline viewing or for generating a backup of a static website. In addition, you can use it to retrieve content and files from various web servers.
Install wget
Launch command line application in Ubuntu that is terminal by pressing the Ctrl+Alt+T key combinations. Then enter the below command to install wget with sudo.
When prompted for a password, enter the sudo password.
Download file or webpage using wget
To download a file or a webpage, open the Terminal and enter the command in the following syntax:
To save a single webpage, enter the command in the following syntax:
Download files with a different name
If you want to download and save the file with a different name than the name of the original remote file, use -O (upper-case O) as shown below. This is helpful especially when you are downloading a webpage that automatically get saved with the name “index.html”.
To download a file with a different name, enter the command in the following syntax:
Download files through FTP
To download a file from an FTP server, type the command in the following syntax:
To download files from user authenticated FTP servers, use the below syntax:
Recursively download files
You can use the recursive download feature to download everything under the specified directory whether a website or an FTP site. To use the recursive download feature, enter the command in the below syntax:
Download multiple files
You can use wget to download multiple files. Make a text file with a list of file URLs, then use the wget command in the following syntax to download that list.
For instance, I have the text file named “downloads.txt” in which there is a list of two URLs that I want to download using wget. You can see my text file content in the below image:
I will use the below command to download the file links contained in the text file:
You can see that it is downloading both links one by one.
Pause and Resume download
You can Press Ctrl + C to pause a download. To resume a paused download, go to the same directory where you were downloading the file previously and use –c option after wget as in the below syntax:
Using the above command, you will notice that your download has resumed from where it was paused.
So in this article, we have discussed the basic usage of two command-line methods using which you can download a file. One thing to Note that if you do not specify a directory while downloading a file, the files will be downloaded in the current directory in which you are working.
Karim Buzdar
About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn
5 Linux Command Line Based Tools for Downloading Files and Browsing Websites
Linux command-line, the most adventurous and fascinating part of GNU/Linux is very cool and powerful tool. Command line itself is very productive and the availability of various inbuilt and third party command line application makes Linux robust and powerful. The Linux Shell supports a variety of web application of various kind be it torrent downloader, dedicated downloader or Internet Surfing.
5 Command Line Internet Tools
Here we are presenting 5 great command line Internet tools, which are very useful and proves to be very handy.
1. rTorrent
rTorrent is a text-based Torrent Client which is written in C++ aimed at high performance. It is available for most of the standard Linux Distributions including FreeBSD and Mac OS X.
Installation of rTorrent
Check if rtorrent is installed correctly by running the following command in the terminal.
rTorrent Command Line Tool
Functioning of rTorrent
Some of the useful Key-bindings and their use.
- CTRL+ q – Quit rTorrent Application
- CTRL+ s – Start Download
- CTRL+ d – Stop an active Download or Remove an already stopped Download.
- CTRL+ k – Stop and Close an active Download.
- CTRL+ r – Hash Check a torrent before Upload/Download Begins.
- CTRL+ q – When this key combination is executed twice, rTorrent shutdown without sending a stop Signal.
- Left Arrow Key – Redirect to Previous screen.
- Right Arrow Key – Redirect to Next Screen
2. Wget
Wget, is a part of GNU Project, the name is derived from World Wide Web (WWW). Wget is a brilliant tool which is useful for recursive download, offline viewing of HTML from local Server and is available for most of the platforms be it Windows, Mac, Linux. Wget makes it possible to download files over HTTP, HTTPS and FTP. Moreover it can be useful in mirroring the whole website as well as support for proxy browsing, pausing/resuming Downloads.
Installation of Wget
Wget being a GNU project comes bundled with Most of the Standard Linux Distributions and there is no need to download and install it separately. If in-case, it’s not installed by default, you can still install it using apt or yum.
Some Basic Usage of Wget
Download a single file using wget.
Download a whole website, recursively.
Download specific type of file (say pdf and png) from a website.
Wget is a wonderful tool which enables custom and filtered download even on limited resource Machine. A screen shot of wget download, where we are mirroring a website (Yahoo.com).
Wget Command Line File Download
For more such wget download examples, read our article that shows 10 Wget Download Command Examples.
3. cURL
cURL is a command line tool for transferring data over a number of protocols. cURL is a client side application which support protocols like FTP, HTTP, FTPS, TFTP, TELNET, IMAP, POP3, etc. cURL is a simple downloader which is different from wget in supporting LDAP, POP3 as compared to others. Moreover Proxy Downloading, pausing download, resuming download are well supported in cURL.
Installation of cURL
By default cURL is available in most of the distribution either in repository or installed. if it’s not installed, just do a apt or yum to get a required package from the repository.
Basic Usage of cURL
4. w3m
The w3m is a text based web browser released under GPL. W3m support tables, frames, color, SSL connection and inline images. W3m is known for fast browsing.
Installation of w3m
Again w3m is available by default in most of the Linux Distribution. If incase, it is not available you can always apt or yum the required package.
Basic Usage of w3m
5. Elinks
Elinks is a free text-based web browser for Unix and Unix based System. Elinks support HTTP, HTTP Cookies and also support browsing script in Perl and Ruby. Tab based browsing is well supported. The best thing is that it supports Mouse, Display Colours and support a number of Protocols like HTTP, FTP, SMB, Ipv4 and Ipv6.
Installation of Elinks
By default elinks also available in most of the Linux distributions. If not, install it via apt or yum.
Basic Usage of Elinks
That’s all for now. I’ll be here again with an interesting article which you people will love to read. Till then stay tuned and connected to Tecmint and don’t forget to give your valuable feedback in comment section.
If You Appreciate What We Do Here On TecMint, You Should Consider:
TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
We are thankful for your never ending support.
Copy Files Between Windows and Linux Using Command Line
It is not always that you will need to copy a file from Windows to Linux or vice versa. But at times when you are automating things or trying to achieve some copy functionality using a script, it is good to have a utility to do that. Here is where pscp comes into play. Using pscp you can copy the file to/from windows and Linux. In this guide, I will go through the steps of doing the same.
Copy File from Windows To Linux
1. Download pscp.exe from here
2. copy the pscp.exe executable to the system32 directory of your windows machine. This folder normally exists in C:\Windows\System32 path.
3. Open PowerShell and use the following command to verify if pscp is accessible from the path.
4. Use the following format to copy the file to the Linux box.
- -pw for the password.
- replace password with the Linux user password.
- C:\Users\Admin\Desktop\test.txt represents the path of the file that has to be copied to the Linux system.
- 192.168.33.10 is the IP of the Linux server.
- /home/vagrant is the user-accessible path in the Linux system to copy the file.
If you are using private keys for authentications, you can use -i flag instead of -pw followed by the path to the .ppk file. If your key file is in pem format, you can use the puttygen command to convert it to ppk.
Info: Learn Linux & Windows administration from Pluralsight with its 10 days free account
For key-based authentication, the command looks like below.
Copy File From Linux To Windows
You can use pscp to copy files from Linux to windows. use the following command format for the same.
The above command will copy the file in Linux from the specified path to the Windows desktop.