这篇文章主要给大家分享linux中curl命令的用法,curl命令使用方法有很多,例如curl url可以获得网址的文本信息,curl -i url可以获取该网址的文本信息以及协议头部信息等等,接下来给大家介绍几种常见的curl命令的使用。
linux中curl命令的使用详情:
1、curl url(获取该网址的文本信息)
curl www.zhujy.com
这就是获取的www.zhujy.com信息
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
2、curl -i url(获取该网址的文本信息以及协议头部信息)
这就是获取的www.zhujy.com文本信息以及协议头部信息。
HTTP/1.1 200 OK
Server: nginx/1.14.0
Date: Mon, 11 Mar 2019 02:06:55 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Mon, 29 Oct 2018 09:52:22 GMT
Connection: keep-alive
ETag: "5bd6d856-264"
Accept-Ranges: bytes
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
大型站长资讯类网站! https://www.0518zz.cn