In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Most people do not understand the knowledge points of this article "how to install and use wget commands in Linux", so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to install and use wget commands in Linux" article.
Wget in the Linux system is a tool for downloading files, which is used on the command line. It is an essential tool for Linux users, and we often have to download some software or restore backups from a remote server to a local server.
Install the wget command
First, we need to check whether the wget command has been installed on the system. Here, take the RPM package management system as an example, as follows:
Rpm-qa wget
If it is not installed, you can use the yum command to install it in the following format:
Yum-y install wget
The parameter-y table here confirms any prompts before installing the package, which is equivalent to choosing y by default if you are asked if you are [yportage].
If you are using another distribution such as Ubuntu,Debian, the general system has the wget command installed by default. If not, you can install it with the following command.
Sudo apt install wget01, single file download
This command downloads a single file and stores it in the current directory. It also shows the download progress, size, date and time during the download process.
Wget http://ftp.gnu.org/gnu/wget/wget-1.5.3.tar.gz02, download the file, and specify a save name
Use the-O (uppercase) option to download files with different file names. Here, we save it using the wget.zip file name, as shown below.
Wget-O wget.zip http://ftp.gnu.org/gnu/wget/wget-1.5.3.tar.gz03, downloading multiple files using http or ftp protocol
Here, we show how to download multiple files to a file directory using the HTTP and FTP protocols and the wget command.
Wget http://ftp.gnu.org/gnu/wget/wget-1.5.3.tar.gz ftp://ftp.gnu.org/gnu/wget/wget-1.10.1.tar.gz.sig
It only needs to be followed by multiple addresses, separated by spaces.
04. Read the download address from the file and download in bulk
If you want to download some content in bulk, we can store the download address in the file, one on each line, and then read the contents of the file through the wget command for batch download. Note that a parameter I needs to be added here.
For example, we store the download address in the file / opt/wget/url.txt, and we can download the contents of the address in the file with the following command.
Wget-I / opt/wget/url.txt05, breakpoint continuation download
If it is a large file download, it may stop at some point, in which case we can use the-c option to restore the file that was canceled last time. However, when you start downloading a file without specifying the-c option, wget adds a .1 extension to the end of the file, which is considered a new download. Therefore, when downloading large files, it is best to add the-c parameter option.
Wget-c http://linuxfreedom.com/linuxmint/linuxmint.com/stable/19.3/linuxmint-19.3-cinnamon-64bit.iso06. If the file already exists, the default suffix of the downloaded file is to add a number.
When you start a download without the-c option, wget adds. 1 to the end of the file and starts with a fresh download. If .1 already exists, .2 is appended to the end of the file.
Wget http://linuxfreedom.com/linuxmint/linuxmint.com/stable/19.3/linuxmint-19.3-cinnamon-64bit.iso
For example, if the linuxmint-19.3-cinnamon-64bit.iso file was previously downloaded in the current directory, the downloaded file name will be linuxmint-19.3-cinnamon-64bit.iso.1.
07. Download files in the background
Using the-b option, you can send the download in the background immediately after the download starts and write the log to the / wget/log.txt file.
Wget-b / opt/wget/log.txt http://linuxfreedom.com/linuxmint/linuxmint.com/stable/19.3/linuxmint-19.3-cinnamon-64bit.iso
After the command is executed, the default output is similar to the following, showing the process ID.
Continuing in background, pid 3550.08, download speed limit
Use the parameter option-limit-rate = 100k, the download speed is limited to 100k, and a log will be created under / opt/wget/log.txt, as shown below.
Wget-c-limit-rate=100k / opt/wget/log.txt http://linuxfreedom.com/linuxmint/linuxmint.com/stable/19.3/linuxmint-19.3-cinnamon-64bit.iso09, FTP and HTTP downloads that require user name and password restrictions
Using the option-http-user = username,-http-password = password or-ftp-user = username,-ftp-password = password, you can download HTTP or FTP sites with limited passwords, as shown below.
Wget-- http-user=username-- http-password=password http://linuxfreedom.com/linuxmint/linuxmint.com/stable/19.3/linuxmint-19.3-cinnamon-64bit.isowget-- ftp-user=username-- ftp-password=password http://linuxfreedom.com/linuxmint/linuxmint.com/stable/19.3/linuxmint-19.3-cinnamon-64bit.iso10, view wget version and related help
The options-- version and-- help can view versions and help as needed.
Wget-versionwget-help
There are more options for you to learn about wget, and you can learn more at wget-help.
The above is about the content of this article on "how to install and use wget commands in Linux". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.