Linux入门:常用命令:curl用法【等待后续添加】

来源:互联网 发布:ubuntu Server安装教程 编辑:程序博客网 时间:2024/04/29 12:14

可下载文件地址(url)http://mirrors.163.com/centos/6/centosplus/x86_64/Packages/kernel-2.6.32-642.1.1.el6.centos.plus.x86_64.rpm

$ pwd/root

以下是curl的常用命令

curl -O url【-o与-O简单解释就是下载文件】


-O/–remote-name Write output to a file named as the remote file
–remote-name-all Use the remote file name for all URLs


$ curl -O http://mirrors.163.com/centos/6/centosplus/x86_64/Packages/kernel-2.6.32-642.1.1.el6.centos.plus.x86_64.rpm $ ll-rw-r--r--. 1 root root  34185112 Jul 28 15:54 kernel-2.6.32-642.1.1.el6.centos.plus.x86_64.rpm

curl -o url


-o/–output Write output to instead of stdout
–pass Pass phrase for the private key (SSL/SSH)
–post301 Do not switch to GET after following a 301 redirect (H)
–post302 Do not switch to GET after following a 302 redirect (H)


$ curl -o test.rpm http://mirrors.163.com/centos/6/centosplus/x86_64/Packages/kernel-2.6.32-642.1.1.el6.centos.plus.x86_64.rpm $ ll-rw-r--r--. 1 root root  34185112 Jul 28 15:54 test.rpm

curl -I url


-I/–head Show document info only


[root@localhost ~]# curl -I http://mirrors.163.com/centos/6/centosplus/x86_64/Packages/kernel-2.6.32-642.1.1.el6.centos.plus.x86_64.rpmHTTP/1.1 200 OKServer: nginxDate: Thu, 28 Jul 2016 08:02:32 GMTContent-Type: application/x-redhat-package-managerContent-Length: 34185112Connection: keep-aliveLast-Modified: Wed, 01 Jun 2016 03:52:10 GMTETag: "574e5bea-2099f98"Accept-Ranges: bytes

下载文件还可以使得wget

[root@localhost ~]# wget http://mirrors.163.com/centos/6/centosplus/x86_64/Packages/kernel-2.6.32-642.1.1.el6.centos.plus.x86_64.rpm--2016-07-28 16:05:52--  http://mirrors.163.com/centos/6/centosplus/x86_64/Packages/kernel-2.6.32-642.1.1.el6.centos.plus.x86_64.rpmResolving mirrors.163.com... 123.58.173.185, 123.58.173.186Connecting to mirrors.163.com|123.58.173.185|:80... connected.HTTP request sent, awaiting response... 200 OKLength: 34185112 (33M) [application/x-redhat-package-manager]Saving to: “kernel-2.6.32-642.1.1.el6.centos.plus.x86_64.rpm.118% [============>                                                            ] 6,472,720    603K/s  eta 44s  

【等待后续添加】

0 0
原创粉丝点击