GNU Wget is a free and open source software package for retrieving files using HTTP, HTTPS, and FTP, the most widely-used Internet protocols. The GNU/wget might not be installed on your system and here is how to install it using yum command.
How to use yum to install wget command
Open the Terminal application or login using ssh client and type the following yum command to install wget on CentOS/RHEL 7:
$ sudo yum install wget
Sample outputs:
Fig.01: Installing GNU/wget on CentOS/RHEL using yum command
A note about Fedora Linux users
Use the following dnf command to install wget on Fedora 24:
$ sudo dnf install wget
How to install wget on CentOS 7 or RHEL 6
$ sudo yum install wget
Installing wget on CentOS 8 or RHEL 8
Again use the same command:
$ sudo yum install wget
Sample outputs:
Red Hat Update Infrastructure 3 Client Configur 1.9 kB/s | 2.1 kB 00:01 Red Hat Enterprise Linux 8 for x86_64 - AppStre 5.6 MB/s | 7.7 MB 00:01 Red Hat Enterprise Linux 8 for x86_64 - BaseOS 16 MB/s | 4.7 MB 00:00 Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: wget x86_64 1.19.5-7.el8_0.1 rhel-8-appstream-rhui-rpms 734 k Transaction Summary ================================================================================ Install 1 Package Total download size: 734 k Installed size: 2.8 M Is this ok [y/N]: y Downloading Packages: wget-1.19.5-7.el8_0.1.x86_64.rpm 5.9 MB/s | 734 kB 00:00 -------------------------------------------------------------------------------- Total 5.3 MB/s | 734 kB 00:00 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : wget-1.19.5-7.el8_0.1.x86_64 1/1 Running scriptlet: wget-1.19.5-7.el8_0.1.x86_64 1/1 Verifying : wget-1.19.5-7.el8_0.1.x86_64 1/1 Installed: wget-1.19.5-7.el8_0.1.x86_64 Complete!
How do I use wget command?
The syntax is:
wget url
wget [options] http://url
wget [options] ftp://url
Usage and examples
To download a file from the internet, enter:
$ wget https://www.cyberciti.biz/files/adduser.txt
Sample outputs:
--2016-11-22 08:45:26-- https://www.cyberciti.biz/files/adduser.txt Resolving www.cyberciti.biz (www.cyberciti.biz)... 75.126.153.202 Connecting to www.cyberciti.biz (www.cyberciti.biz)|75.126.153.202|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 1022 [text/plain] Saving to: 'adduser.txt' 100%[======================================>] 1,022 --.-K/s in 0s 2016-11-22 08:45:27 (59.4 MB/s) - 'adduser.txt' saved [1022/1022]
To use the wget with proxy authentication, enter:
$ export https_proxy="https://server1.cyberciti.biz:3128/"
$ wget --proxy-user "USERNameHere" --proxy-password "PASSWORDHere" http://url-here
To use wget with a username and password for FTP / HTTP file retrieval, use:
$ wget --user=NAME --password='PASSWORD' url
To download a large file in size in background, enter:
$ wget -bqc http://path-to-freebsd-mirros-url/freebsd-lastest.iso
You can resume broken download with wget using the following syntax:
$ wget -c http://url/large.file.tar.gz
$ wget --continue https://url/file.iso
Anther usage is to archive a website using wget:
$ wget -nprk 'https://www.some-url-here/'
Creating ~/.wgetrc file
The $HOME/.wgetrc file act as an initialization file for GNU wget. You can store option in it. Here is my sample $HOME/.wgetrc file:
# sample file # Try ipv6 addresses first prefer-family = IPv6 # Setup proxy https_proxy = http://server1.cyberciti.biz:3128/ http_proxy = http://server1.cyberciti.biz:3128/ ftp_proxy = http://server1.cyberciti.biz:3128/ # Setup the credentials for both http/ftp user=vivek password=OhMyCoolPasswordHere
Conclusion
You learned how to install wget on RHEL or CentOS 7 using the command line. See the following for more info.
- Linux and Unix wget: Your Ultimate Command Line Downloader
- wget command manual
- man 1 wget
🐧 1 comment so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
use curl ;)