curl命令的基本使用
Linux操作系统的curl命令的基本使用
作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。
curl是基于URL语法在命令行方式下工作的文件传输工具,它支持FTP,FTPS,HTTP,HTTPS,GOPHER,TELNET,DICT,FILE及LDAP等协议; curl支持HTTPS认证,并且支持HTTP的POST、PUT等方法, FTP上传, kerberos认证,HTTP上传,代理服务器,cookies,用户名/密码认证, 下载文件断点续传,上载文件断点续传, http代理服务器管道( proxy tunneling); curl还支持IPv6,socks5代理服务器,通过http代理服务器上传文件到FTP服务器等,功能十分强大。
语法格式:
curl [options] [URL...] 常用选项如下所示:
-A/--user-agent <string>:
设置用户代理发送给服务器 -e/--referer <URL>:
来源网址 --cacert <file>:
CA证书 (SSL) -k/--insecure:
允许忽略证书进行 SSL 连接 --compressed:
要求返回是压缩的格式 -H/--header <line>:
自定义首部信息传递给服务器 -i:
显示页面内容,包括报文首部信息 -I/--head:
只显示响应报文首部信息 -D/--dump-header <file>:
将url的header信息存放在指定文件中 --basic:
使用HTTP基本认证
-u/--user <user[:password]>:
设置服务器的用户和密码
-L:
如果有3xx响应码,重新发请求到新位置
-O:
使用URL中默认的文件名保存文件到本地
-o <file>:
将网络文件保存为指定的文件中
--limit-rate <rate>:
设置传输速度
-0/--http1.0:
数字0,使用HTTP 1.0
-v/--verbose:
更详细 -C:
选项可对文件使用断点续传功能
-c/--cookie-jar <file name>:
将url中cookie存放在指定文件中
-x/--proxy <proxyhost[:port]>:
指定代理服务器地址
-X/--request <command>:
向服务器发送指定请求方法
-U/--proxy-user <user:password>:
代理服务器用户和密码
-T:
选项可将指定的本地文件上传到FTP服务器上
--data/-d:
方式指定使用POST方式传递数据
-b name=data:
从服务器响应set-cookie得到值,返回给服务器
1>."-A/--user-agent <string>"案例
[root@node101.yinzhengjie.org.cn ~]# curl -A 'Chrome/78.0.3904.108 Safari/537.36' http://node107.yinzhengjie.org.cn #设置用户代理发送给服务器,其实就是封装了请求报文中的"User-Agent"参数,可以结合"-v"选项查看的更详细。
<h1>尹正杰到此一游</h1>
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# curl --user-agent 'Firefox/108 ' http://node107.yinzhengjie.org.cn
<h1>尹正杰到此一游</h1>
[root@node101.yinzhengjie.org.cn ~]#
[root@node107.yizhengjie.org.cn ~]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN *: *:*
LISTEN *: *:*
LISTEN ::: :::*
[root@node107.yizhengjie.org.cn ~]#
[root@node107.yizhengjie.org.cn ~]# ll /var/www/html/index.html
-rw-r--r-- root root Dec : /var/www/html/index.html
[root@node107.yizhengjie.org.cn ~]#
[root@node107.yizhengjie.org.cn ~]# cat /var/www/html/index.html
<h1>尹正杰到此一游</h1>
[root@node107.yizhengjie.org.cn ~]#
[root@node107.yizhengjie.org.cn ~]# tail -10f /var/log/httpd/access_log #查看服务端日志,观察请求日志信息
......
172.30.1.101 - - [/Dec/::: +] "GET / HTTP/1.1" "-" "Chrome/78.0.3904.108 Safari/537.36"
172.30.1.101 - - [/Dec/::: +] "GET / HTTP/1.1" "-" "Firefox/108"
[root@node107.yizhengjie.org.cn ~]# tail -10f /var/log/httpd/access_log #查看服务端日志,观察请求日志信息,观察服务端是否有上面记录中的User-Agent参数记录。
2>."-v/--verbose"案例显示一次的http请求的通信过程
[root@node101.yinzhengjie.org.cn ~]# curl -A 'Chrome/78.0.3904.108 Safari/537.36' http://node107.yinzhengjie.org.cn -v #显示http请求的通信过程,包括request,response,以及正文。
* About to connect() to node107.yinzhengjie.org.cn port 80 (#0)
* Trying 172.30.1.107...
* Connected to node107.yinzhengjie.org.cn (172.30.1.107) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: Chrome/78.0.3904.108 Safari/537.36
> Host: node107.yinzhengjie.org.cn
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Tue, 10 Dec 2019 14:18:12 GMT
< Server: Apache/2.4.6 (CentOS) PHP/5.4.16
< Last-Modified: Tue, 10 Dec 2019 14:17:04 GMT
< ETag: "1f-5995a2a997640"
< Accept-Ranges: bytes
< Content-Length: 31
< Content-Type: text/html; charset=UTF-8
<
<h1>尹正杰到此一游</h1>
* Connection #0 to host node107.yinzhengjie.org.cn left intact
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
3>."-e/--referer <URL>"案例
[root@node101.yinzhengjie.org.cn ~]# curl -e "www.baidu.com" http://node107.yinzhengjie.org.cn -v #指定来源网址为"www.baidu.com"
* About to connect() to node107.yinzhengjie.org.cn port (#)
* Trying 172.30.1.107...
* Connected to node107.yinzhengjie.org.cn (172.30.1.107) port (#)
> GET / HTTP/1.1
> User-Agent: curl/7.29.
> Host: node107.yinzhengjie.org.cn
> Accept: */*
> Referer: www.baidu.com
>
< HTTP/1.1 200 OK
< Date: Tue, 10 Dec 2019 14:45:15 GMT
< Server: Apache/2.4.6 (CentOS) PHP/5.4.16
< Last-Modified: Tue, 10 Dec 2019 14:17:04 GMT
< ETag: "1f-5995a2a997640"
< Accept-Ranges: bytes
< Content-Length: 31
< Content-Type: text/html; charset=UTF-8
<
<h1>尹正杰到此一游</h1>
* Connection #0 to host node107.yinzhengjie.org.cn left intact
[root@node101.yinzhengjie.org.cn ~]#
[root@node107.yizhengjie.org.cn ~]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN *: *:*
LISTEN *: *:*
LISTEN ::: :::*
[root@node107.yizhengjie.org.cn ~]#
[root@node107.yizhengjie.org.cn ~]# ll /var/www/html/index.html
-rw-r--r-- root root Dec : /var/www/html/index.html
[root@node107.yizhengjie.org.cn ~]#
[root@node107.yizhengjie.org.cn ~]# cat /var/www/html/index.html
<h1>尹正杰到此一游</h1>
[root@node107.yizhengjie.org.cn ~]#
[root@node107.yizhengjie.org.cn ~]# tail -10f /var/log/httpd/access_log #查看服务端日志,观察请求日志信息
......
172.30.1.101 - - [/Dec/::: +] "GET / HTTP/1.1" "www.baidu.com" "curl/7.29.0"
[root@node107.yizhengjie.org.cn ~]# tail -10f /var/log/httpd/access_log #查看服务端日志,观察请求日志信息,观察服务端是否有上面记录中的User-Agent参数记录。
4>."-I/--head"案例
[root@node101.yinzhengjie.org.cn ~]# curl -I http://node107.yinzhengjie.org.cn #只显示响应报文首部信息
HTTP/1.1 OK
Date: Tue, Dec :: GMT
Server: Apache/2.4. (CentOS) PHP/5.4.
Last-Modified: Tue, Dec :: GMT
ETag: "1f-5995a2a997640"
Accept-Ranges: bytes
Content-Length:
Content-Type: text/html; charset=UTF- [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# curl --head http://node107.yinzhengjie.org.cn
HTTP/1.1 OK
Date: Tue, Dec :: GMT
Server: Apache/2.4. (CentOS) PHP/5.4.
Last-Modified: Tue, Dec :: GMT
ETag: "1f-5995a2a997640"
Accept-Ranges: bytes
Content-Length:
Content-Type: text/html; charset=UTF- [root@node101.yinzhengjie.org.cn ~]#
[root@node107.yizhengjie.org.cn ~]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN *: *:*
LISTEN *: *:*
LISTEN ::: :::*
[root@node107.yizhengjie.org.cn ~]#
[root@node107.yizhengjie.org.cn ~]# ll /var/www/html/index.html
-rw-r--r-- root root Dec : /var/www/html/index.html
[root@node107.yizhengjie.org.cn ~]#
[root@node107.yizhengjie.org.cn ~]# cat /var/www/html/index.html
<h1>尹正杰到此一游</h1>
[root@node107.yizhengjie.org.cn ~]#
[root@node107.yizhengjie.org.cn ~]# tail -10f /var/log/httpd/access_log #查看服务端日志,观察请求日志信息
......
172.30.1.101 - - [/Dec/::: +] "HEAD / HTTP/1.1" - "-" "curl/7.29.0"
172.30.1.101 - - [/Dec/::: +] "HEAD / HTTP/1.1" - "-" "curl/7.29.0"
[root@node107.yizhengjie.org.cn ~]# tail -10f /var/log/httpd/access_log #查看服务端日志,观察请求日志信息,观察服务端是否有上面记录中的User-Agent参数记录。
5>."-i"案例
[root@node101.yinzhengjie.org.cn ~]# curl -i http://node107.yinzhengjie.org.cn #显示页面内容,包括报文首部信息
HTTP/1.1 OK
Date: Tue, Dec :: GMT
Server: Apache/2.4. (CentOS) PHP/5.4.
Last-Modified: Tue, Dec :: GMT
ETag: "1f-5995a2a997640"
Accept-Ranges: bytes
Content-Length:
Content-Type: text/html; charset=UTF- <h1>尹正杰到此一游</h1>
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
[root@node107.yizhengjie.org.cn ~]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN *: *:*
LISTEN *: *:*
LISTEN ::: :::*
[root@node107.yizhengjie.org.cn ~]#
[root@node107.yizhengjie.org.cn ~]# ll /var/www/html/index.html
-rw-r--r-- root root Dec : /var/www/html/index.html
[root@node107.yizhengjie.org.cn ~]#
[root@node107.yizhengjie.org.cn ~]# cat /var/www/html/index.html
<h1>尹正杰到此一游</h1>
[root@node107.yizhengjie.org.cn ~]#
[root@node107.yizhengjie.org.cn ~]# tail -10f /var/log/httpd/access_log #查看服务端日志,观察请求日志信息
......
172.30.1.101 - - [/Dec/::: +] "GET / HTTP/1.1" "-" "curl/7.29.0"
[root@node107.yizhengjie.org.cn ~]# tail -10f /var/log/httpd/access_log #查看服务端日志,观察请求日志信息,观察服务端是否有上面记录中的User-Agent参数记录。
6>."--cacert <file>"案例
[root@node101.yinzhengjie.org.cn ~]# curl https://www.yinzhengjie.org.cn --cacert /etc/httpd/conf.d/ssl/cacert.pem #使用证书检查访问网页
<h1>尹正杰到此一游</h1>
[root@node101.yinzhengjie.org.cn ~]#
7>."-k/--insecure"案例
[root@node101.yinzhengjie.org.cn ~]# curl -k https://www.yinzhengjie.org.cn --cacert /etc/httpd/conf.d/ssl/cacert.pem #忽略证书检查访问网页
<h1>尹正杰到此一游</h1>
[root@node101.yinzhengjie.org.cn ~]#
8>."-c/--cookie-jar <file name>"案例
[root@node101.yinzhengjie.org.cn ~]# curl -c /root/cookie.txt http://node107.yinzhengjie.org.cn/setcookie.php # 将url中cookie存放在指定文件中
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# cat /root/cookie.txt
# Netscape HTTP Cookie File
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk. node107.yinzhengjie.org.cn FALSE / FALSE department IT
node107.yinzhengjie.org.cn FALSE / FALSE user Jason
[root@node101.yinzhengjie.org.cn ~]#
9>."-X/--request <command>"案例
[root@node101.yinzhengjie.org.cn ~]# curl -X PUT www.baidu.com #向服务端发送指定请求的方法,此处我们指定的方法是PUT,下面依次提交的方法是GET,DELETE以及POST方法。
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# curl -X GET www.baidu.com
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# curl -X DELETE www.baidu.com
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# curl -X POST www.baidu.com
[root@node101.yinzhengjie.org.cn ~]#
10>."-D/--dump-header <file>"案例
[root@node101.yinzhengjie.org.cn ~]# ll
total
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# curl -D yinzhengjie.html http://node107.yinzhengjie.org.cn #显示整个网页数据,并将响应头信息存入yinzhengjie.html
<h1>尹正杰到此一游</h1>
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r-- root root Dec : yinzhengjie.html
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# cat yinzhengjie.html
HTTP/1.1 OK
Date: Tue, Dec :: GMT
Server: Apache/2.4. (CentOS) PHP/5.4.
Last-Modified: Tue, Dec :: GMT
ETag: "1f-5995a2a997640"
Accept-Ranges: bytes
Content-Length:
Content-Type: text/html; charset=UTF- [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
11>."-u/--user <user[:password]>"案例
如下图所示,我用自己的用户名登陆我们公司的OA账号信息。
12>.查看帮助
[root@node101.yinzhengjie.org.cn ~]# curl --help
Usage: curl [options...] <url>
Options: (H) means HTTP/HTTPS only, (F) means FTP only
--anyauth Pick "any" authentication method (H)
-a, --append Append to target file when uploading (F/SFTP)
--basic Use HTTP Basic Authentication (H)
--cacert FILE CA certificate to verify peer against (SSL)
--capath DIR CA directory to verify peer against (SSL)
-E, --cert CERT[:PASSWD] Client certificate file and password (SSL)
--cert-type TYPE Certificate file type (DER/PEM/ENG) (SSL)
--ciphers LIST SSL ciphers to use (SSL)
--compressed Request compressed response (using deflate or gzip)
-K, --config FILE Specify which config file to read
--connect-timeout SECONDS Maximum time allowed for connection
-C, --continue-at OFFSET Resumed transfer offset
-b, --cookie STRING/FILE String or file to read cookies from (H)
-c, --cookie-jar FILE Write cookies to this file after operation (H)
--create-dirs Create necessary local directory hierarchy
--crlf Convert LF to CRLF in upload
--crlfile FILE Get a CRL list in PEM format from the given file
-d, --data DATA HTTP POST data (H)
--data-ascii DATA HTTP POST ASCII data (H)
--data-binary DATA HTTP POST binary data (H)
--data-urlencode DATA HTTP POST data url encoded (H)
--delegation STRING GSS-API delegation permission
--digest Use HTTP Digest Authentication (H)
--disable-eprt Inhibit using EPRT or LPRT (F)
--disable-epsv Inhibit using EPSV (F)
-D, --dump-header FILE Write the headers to this file
--egd-file FILE EGD socket path for random data (SSL)
--engine ENGINGE Crypto engine (SSL). "--engine list" for list
-f, --fail Fail silently (no output at all) on HTTP errors (H)
-F, --form CONTENT Specify HTTP multipart POST data (H)
--form-string STRING Specify HTTP multipart POST data (H)
--ftp-account DATA Account data string (F)
--ftp-alternative-to-user COMMAND String to replace "USER [name]" (F)
--ftp-create-dirs Create the remote dirs if not present (F)
--ftp-method [MULTICWD/NOCWD/SINGLECWD] Control CWD usage (F)
--ftp-pasv Use PASV/EPSV instead of PORT (F)
-P, --ftp-port ADR Use PORT with given address instead of PASV (F)
--ftp-skip-pasv-ip Skip the IP address for PASV (F)
--ftp-pret Send PRET before PASV (for drftpd) (F)
--ftp-ssl-ccc Send CCC after authenticating (F)
--ftp-ssl-ccc-mode ACTIVE/PASSIVE Set CCC mode (F)
--ftp-ssl-control Require SSL/TLS for ftp login, clear for transfer (F)
-G, --get Send the -d data with a HTTP GET (H)
-g, --globoff Disable URL sequences and ranges using {} and []
-H, --header LINE Custom header to pass to server (H)
-I, --head Show document info only
-h, --help This help text
--hostpubmd5 MD5 Hex encoded MD5 string of the host public key. (SSH)
-, --http1. Use HTTP 1.0 (H)
--ignore-content-length Ignore the HTTP Content-Length header
-i, --include Include protocol headers in the output (H/F)
-k, --insecure Allow connections to SSL sites without certs (H)
--interface INTERFACE Specify network interface/address to use
-, --ipv4 Resolve name to IPv4 address
-, --ipv6 Resolve name to IPv6 address
-j, --junk-session-cookies Ignore session cookies read from file (H)
--keepalive-time SECONDS Interval between keepalive probes
--key KEY Private key file name (SSL/SSH)
--key-type TYPE Private key file type (DER/PEM/ENG) (SSL)
--krb LEVEL Enable Kerberos with specified security level (F)
--libcurl FILE Dump libcurl equivalent code of this command line
--limit-rate RATE Limit transfer speed to this rate
-l, --list-only List only names of an FTP directory (F)
--local-port RANGE Force use of these local port numbers
-L, --location Follow redirects (H)
--location-trusted like --location and send auth to other hosts (H)
-M, --manual Display the full manual
--mail-from FROM Mail from this address
--mail-rcpt TO Mail to this receiver(s)
--mail-auth AUTH Originator address of the original email
--max-filesize BYTES Maximum file size to download (H/F)
--max-redirs NUM Maximum number of redirects allowed (H)
-m, --max-time SECONDS Maximum time allowed for the transfer
--metalink Process given URLs as metalink XML file
--negotiate Use HTTP Negotiate Authentication (H)
-n, --netrc Must read .netrc for user name and password
--netrc-optional Use either .netrc or URL; overrides -n
--netrc-file FILE Set up the netrc filename to use
-N, --no-buffer Disable buffering of the output stream
--no-keepalive Disable keepalive use on the connection
--no-sessionid Disable SSL session-ID reusing (SSL)
--noproxy List of hosts which do not use proxy
--ntlm Use HTTP NTLM authentication (H)
-o, --output FILE Write output to <file> instead of stdout
--pass PASS Pass phrase for the private key (SSL/SSH)
--post301 Do not switch to GET after following a redirect (H)
--post302 Do not switch to GET after following a redirect (H)
--post303 Do not switch to GET after following a redirect (H)
-#, --progress-bar Display transfer progress as a progress bar
--proto PROTOCOLS Enable/disable specified protocols
--proto-redir PROTOCOLS Enable/disable specified protocols on redirect
-x, --proxy [PROTOCOL://]HOST[:PORT] Use proxy on given port
--proxy-anyauth Pick "any" proxy authentication method (H)
--proxy-basic Use Basic authentication on the proxy (H)
--proxy-digest Use Digest authentication on the proxy (H)
--proxy-negotiate Use Negotiate authentication on the proxy (H)
--proxy-ntlm Use NTLM authentication on the proxy (H)
-U, --proxy-user USER[:PASSWORD] Proxy user and password
--proxy1. HOST[:PORT] Use HTTP/1.0 proxy on given port
-p, --proxytunnel Operate through a HTTP proxy tunnel (using CONNECT)
--pubkey KEY Public key file name (SSH)
-Q, --quote CMD Send command(s) to server before transfer (F/SFTP)
--random-file FILE File for reading random data from (SSL)
-r, --range RANGE Retrieve only the bytes within a range
--raw Do HTTP "raw", without any transfer decoding (H)
-e, --referer Referer URL (H)
-J, --remote-header-name Use the header-provided filename (H)
-O, --remote-name Write output to a file named as the remote file
--remote-name-all Use the remote file name for all URLs
-R, --remote-time Set the remote file's time on the local output
-X, --request COMMAND Specify request command to use
--resolve HOST:PORT:ADDRESS Force resolve of HOST:PORT to ADDRESS
--retry NUM Retry request NUM times if transient problems occur
--retry-delay SECONDS When retrying, wait this many seconds between each
--retry-max-time SECONDS Retry only within this period
-S, --show-error Show error. With -s, make curl show errors when they occur
-s, --silent Silent mode. Don't output anything
--socks4 HOST[:PORT] SOCKS4 proxy on given host + port
--socks4a HOST[:PORT] SOCKS4a proxy on given host + port
--socks5 HOST[:PORT] SOCKS5 proxy on given host + port
--socks5-basic Enable username/password auth for SOCKS5 proxies
--socks5-gssapi Enable GSS-API auth for SOCKS5 proxies
--socks5-hostname HOST[:PORT] SOCKS5 proxy, pass host name to proxy
--socks5-gssapi-service NAME SOCKS5 proxy service name for gssapi
--socks5-gssapi-nec Compatibility with NEC SOCKS5 server
-Y, --speed-limit RATE Stop transfers below speed-limit for 'speed-time' secs
-y, --speed-time SECONDS Time for trig speed-limit abort. Defaults to
--ssl Try SSL/TLS (FTP, IMAP, POP3, SMTP)
--ssl-reqd Require SSL/TLS (FTP, IMAP, POP3, SMTP)
-, --sslv2 Use SSLv2 (SSL)
-, --sslv3 Use SSLv3 (SSL)
--ssl-allow-beast Allow security flaw to improve interop (SSL)
--stderr FILE Where to redirect stderr. - means stdout
--tcp-nodelay Use the TCP_NODELAY option
-t, --telnet-option OPT=VAL Set telnet option
--tftp-blksize VALUE Set TFTP BLKSIZE option (must be >)
-z, --time-cond TIME Transfer based on a time condition
-, --tlsv1 Use => TLSv1 (SSL)
--tlsv1. Use TLSv1. (SSL)
--tlsv1. Use TLSv1. (SSL)
--tlsv1. Use TLSv1. (SSL)
--trace FILE Write a debug trace to the given file
--trace-ascii FILE Like --trace but without the hex output
--trace-time Add time stamps to trace/verbose output
--tr-encoding Request compressed transfer encoding (H)
-T, --upload-file FILE Transfer FILE to destination
--url URL URL to work with
-B, --use-ascii Use ASCII/text transfer
-u, --user USER[:PASSWORD] Server user and password
--tlsuser USER TLS username
--tlspassword STRING TLS password
--tlsauthtype STRING TLS authentication type (default SRP)
--unix-socket FILE Connect through this UNIX domain socket
-A, --user-agent STRING User-Agent to send to server (H)
-v, --verbose Make the operation more talkative
-V, --version Show version number and quit
-w, --write-out FORMAT What to output after completion
--xattr Store metadata in extended file attributes
-q If used as the first parameter disables .curlrc
[root@node101.yinzhengjie.org.cn ~]# re
[root@node101.yinzhengjie.org.cn ~]# curl --help
四.elinks工具
1>.安装elinks工具
[root@node101.yinzhengjie.org.cn ~]# yum -y install elinks
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink | 8.6 kB ::
* base: mirrors.huaweicloud.com
* epel: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.huaweicloud.com
* updates: mirrors.huaweicloud.com
base | 3.6 kB ::
epel | 5.3 kB ::
extras | 2.9 kB ::
updates | 2.9 kB ::
(/): epel/x86_64/primary_db | 6.9 MB ::
(/): epel/x86_64/updateinfo | 1.0 MB ::
Resolving Dependencies
--> Running transaction check
---> Package elinks.x86_64 :0.12-0.37.pre6.el7.0.1 will be installed
--> Processing Dependency: libnss_compat_ossl.so.()(64bit) for package: elinks-0.12-0.37.pre6.el7.0.1.x86_64
--> Processing Dependency: libmozjs185.so.1.0()(64bit) for package: elinks-0.12-0.37.pre6.el7.0.1.x86_64
--> Running transaction check
---> Package js.x86_64 :1.8.-.el7 will be installed
---> Package nss_compat_ossl.x86_64 :0.9.-.el7 will be installed
--> Finished Dependency Resolution Dependencies Resolved =============================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================
Installing:
elinks x86_64 0.12-0.37.pre6.el7.0.1 base k
Installing for dependencies:
js x86_64 :1.8.-.el7 base 2.3 M
nss_compat_ossl x86_64 0.9.-.el7 base k Transaction Summary
=============================================================================================================================================
Install Package (+ Dependent packages) Total download size: 3.2 M
Installed size: 9.6 M
Downloading packages:
(/): elinks-0.12-0.37.pre6.el7.0.1.x86_64.rpm | kB ::
(/): js-1.8.-.el7.x86_64.rpm | 2.3 MB ::
(/): nss_compat_ossl-0.9.-.el7.x86_64.rpm | kB ::
---------------------------------------------------------------------------------------------------------------------------------------------
Total 5.4 MB/s | 3.2 MB ::
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : nss_compat_ossl-0.9.-.el7.x86_64 /
Installing : :js-1.8.-.el7.x86_64 /
Installing : elinks-0.12-0.37.pre6.el7.0.1.x86_64 /
Verifying : elinks-0.12-0.37.pre6.el7.0.1.x86_64 /
Verifying : :js-1.8.-.el7.x86_64 /
Verifying : nss_compat_ossl-0.9.-.el7.x86_64 / Installed:
elinks.x86_64 :0.12-0.37.pre6.el7.0.1 Dependency Installed:
js.x86_64 :1.8.-.el7 nss_compat_ossl.x86_64 :0.9.-.el7 Complete!
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# yum -y install elinks
2>.使用elinks访问网页
[root@node101.yinzhengjie.org.cn ~]# elinks http://node107.yinzhengjie.org.cn #执行该命令后会弹出一个字符界面的对话框。
3>.使用"-source"选项
[root@node101.yinzhengjie.org.cn ~]# elinks -source http://node107.yinzhengjie.org.cn #可以打印网页源码
<h1>尹正杰到此一游</h1>
[root@node101.yinzhengjie.org.cn ~]#
4>.使用"-dump:"选项案例
[root@node101.yinzhengjie.org.cn ~]# elinks -dump http://node107.yinzhengjie.org.cn #非交互式模式,将URL的内容输出至标准输出
尹正杰到此一游
[root@node101.yinzhengjie.org.cn ~]#
curl命令的基本使用的更多相关文章
- curl命令使用
curl命令可以用来构造http请求.参数有很多,常用的参数如下: 通用语法:curl [option] [URL...]在处理URL时其支持类型于SHELL的名称扩展功能,如http://www.j ...
- curl命令行使用
curl 命令使用 原文地址:http://blog.sina.com.cn/s/blog_4b9eab320100slyw.html 可以看作命令行浏览器 1.开启gzip请求curl -I h ...
- CURL命令报错:dyld: lazy symbol binding failed: Symbol not found: _SSL_load_error_strings解决办法
Mac OS X 10.11.6, curl 命令报错,错误如下: dyld: lazy symbol binding failed: Symbol not found: _SSL_load_erro ...
- CURL命令详解
curl命令是一个强大的网络工具,它能通过http,ftp等方式下载.上传文件.其中curl远不止这些功能,大家可以通过阅读手册获取更多的信息,类似的工具还有wget. curl命令使用了libcur ...
- limux curl命令
linux curl命令很强大: http://blog.chinaunix.net/uid-14735472-id-3413867.html curl是一种命令行工具,作用是发出网络请求,然后得到和 ...
- linux curl 命令详解,以及实例
linux curl是一个利用URL规则在命令行下工作的文件传输工具.它支持文件的上传和下载,所以是综合传输工具,但按传统,习惯称url为下载工具. 一,curl命令参数,有好多我没有用过,也不知道翻 ...
- 使用curl命令操作elasticsearch
使用curl命令操作elasticsearch 大岩不灿 发表于 2015年4月25日 浏览 7,426 次 第一:_cat系列_cat系列提供了一系列查询elasticsearch集群状态的接口.你 ...
- Linux之curl命令详解
url命令是一个功能强大的网络工具,它能够通过http.ftp等方式下载文件,也能够上传文件.其实curl远不止前面所说的那些功能,大家可以通过man curl阅读手册页获取更多的信息.类似的工具还有 ...
- zabbix通过curl命令判断web服务是否正常并自动重启服务
zabbix通过curl命令判断web服务是否正常并自动重启服务 主要思路: 通过curl命令获取服务器响应码,如果正常返回200,不正常返回000 具体命令: curl -I -s -w " ...
- curl 命令行应用
我一向以为,curl只是一个编程用的函数库. 最近才发现,这个命令本身,就是一个无比有用的网站开发工具,请看我整理的它的用法. =================================== ...
随机推荐
- java 计算器实验
1.计算器实验报告 2.https://github.com/xujinxia/text/tree/master 3.实验截图 7+8 清除 六.总结 通过本次实验让我对JFrame类.JPanel类 ...
- C++课程学习建议
从C到C++,学院都采用了机房授课模式,也在探索更为高效的实践与理论融合的教学方法,对于课程学习来说,仍有以下建议: 1.多看书.看书是理解基本概念的必备手段.也是学习的根本.应将课前预习.课后复习联 ...
- <构建之法>8,9,10章的读后感
第八章 这一章主要讲的是需求分析,主要介绍在客户需求五花八门的情况下,软件团队如何才能准确而全面地找到这些需求. 第九章 问题:我们现在怎样培养才能成为一名合格的PM呢? 第十章 问题:如果典型用户吴 ...
- 开源通用爬虫框架YayCrawler-框架的运行机制
这一节我将向大家介绍一下YayCrawler的运行机制,首先允许我上一张图: 首先各个组件的启动顺序建议是Master.Worker.Admin,其实不按这个顺序也没关系,我们为了讲解方便假定是这个启 ...
- 【转】进程同步之信号量机制(pv操作)及三个经典同步问题
原文地址:http://blog.csdn.net/speedme/article/details/17597373 上篇博客中(进程同步之临界区域问题及Peterson算法),我们对临界区,临界资源 ...
- Neo4j学习案例【转】
转自 打怪的蚂蚁 CSDN: https://blog.csdn.net/xgjianstart/article/details/77285334 neo4j有社区版本和企业版.社区版本是免费的,只支 ...
- Eclipse布局问题小记
当Eclipse的Debug,Console(简称工具条)页面被误操作到占据整行时,通过点击工具条的非选项卡部分,然后向代码区域拖动,即可得恢复非单独行模式.
- ADOquery属性中cursortype,LockType属性
ADOquery属性中cursortype属性 ctOpenForwardOnly 向前移动 - — 除了只能在记录集中向前移动以外,其它的和动态游标类似. ctKeyset 键集 ...
- ADODataSet与ADOQuery的区别
ADODataSet组件 此组件功能是非常强大的,通过ADODataset,可以直接与一个表进行联接,也可以执行SQL语句,还可以执行存储过程,可以说集ADOTable. ADOQuery. A ...
- 构建squid代理服务器
基本概念 本文使用squid代理服务 软件介绍:百度百科 作为应用层的代理服务软件,Squid主要提供缓存加速.应用层过滤控制的功能: 工作机制:缓存网页对象,减少重复请求(HTTP代理的缓存加速对象 ...