Linux wget command. Download files from the internet via SSH
Colleagues hello to all.
In today's article, I will tell you about such a tool in Linux as wget. The wget command can be used to download content from the Internet. The name wget is a combination of the words world wide web and get. The tool supports FTP, SFTP, HTTP, HTTPS download protocols.
Article content:
- Download wget tool.
- Syntax of the wget command.
- Wget command examples.
1. Download the wget tool.
The wget tool doesn't come with Linux, so we need to download it, so we'll use the command.
$. yum install wget
At the time of writing this article, I already installed wget myself, because it tells me that this package is already installed.
2. Wget command syntax.
wget [options] url
- -P - download file to specified directory
- -c - continue downloading the file in case of internet failure
- -O - download the file and save it under a different name
- --tries=10 - number of download attempts
- --limit-rate=200k - download rate limit
- -R bmp - do not download files with bmp extensions
- -A png,jpg - download only images
3. Examples of the wget command.
3.1. The easiest way to download a file is to use the wget command followed by a link to the file.
$. wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-community-client-8.0.29-1.el8.aarch64.rpm
3.2. The second way to download a file is in which directory we want to download the file. In this case, I want to download the file to the /root/mysql directory. The (-P) parameter is responsible for this.
$. wget -P /root/mysql https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-community-client-8.0.29-1.el8.aarch64 .rpm
3.3. When downloading a file, you can immediately change its name, for example, now I will download the file and call it mysql-client.rpm. The (-O) parameter is responsible for this.
$. wget -O mysql-client.rpm https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-community-client-8.0.29-1.el8. aarch64.rpm
3.4. There are times when you want to download something very large, but you don't want downloading the file to take all your traffic. The parameter (--limit-rate=200k) is responsible for limiting traffic.
$. wget --limit-rate=200k https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-community-client-8.0.29-1.el8. aarch64.rpm
Thank you all, I hope that my article helped you in some way.