Home  >  Article  >  Operation and Maintenance  >  How to download files in centos

How to download files in centos

王林
王林Original
2020-05-18 11:14:3112558browse

How to download files in centos

If we want to download a file, we can do it through the wget command.

First check whether wget is installed on the CentOS7 system:

[root@test redis]# rpm -qa|grep wget

If it is installed, it will prompt the currently installed version:

wget-1.14-15.el7_4.1.x86_64

If it is not installed, you can install it through the following command:

yum install -y wget

The syntax format for downloading files is: wget http://wwww.xxxxx. This command will download to the default download directory.

If we want to download to a specified directory, we can use the -P parameter to achieve this:

Command format: wget -P /Directory file download address where the file is saved

-P is followed by the directory where you need to save the file, such as /home/tmp/download, and the last parameter is the URL address of the network file you actually want to download. For example, the following command downloads the 6.4 version of elasticsearch. tar package to the /home/tmp/download directory:

[root@test redis]# wget -P /home/tmp/download https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.2.tar.gz
--2018-10-15 13:58:40--  https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.2.tar.gz
正在解析主机 artifacts.elastic.co (artifacts.elastic.co)... 107.21.127.184, 54.225.221.128, 107.21.237.188, ...
正在连接 artifacts.elastic.co (artifacts.elastic.co)|107.21.127.184|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:97914519 (93M) [application/x-gzip]
正在保存至: “/home/tmp/download/elasticsearch-6.4.2.tar.gz”

Recommended tutorial: centos tutorial

The above is the detailed content of How to download files in centos. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn