这篇文章主要介绍了Linux系统中如何使用curl命令,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

curl是一个非常实用的、用来与服务器之间传输数据的工具;支持的协议包括 (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP),curl设计为无用户交互下完成工作;

curl工具常用选项高数

语法格式:curl[options][URL...]常用选项如下所示:-A/--user-agent:设置用户代理发送给服务器-e/--referer:来源网址--cacert:CA证书(SSL)-k/--insecure:允许忽略证书进行SSL连接--compressed:要求返回是压缩的格式-H/--header:自定义首部信息传递给服务器-i:显示页面内容,包括报文首部信息-I/--head:只显示响应报文首部信息-D/--dump-header:将url的header信息存放在指定文件中--basic:使用HTTP基本认证-u/--user:设置服务器的用户和密码-L:如果有3xx响应码,重新发请求到新位置-O:使用URL中默认的文件名保存文件到本地-o:将网络文件保存为指定的文件中--limit-rate:设置传输速度-0/--http1.0:数字0,使用HTTP1.0-v/--verbose:更详细-C:选项可对文件使用断点续传功能-c/--cookie-jar:将url中cookie存放在指定文件中-x/--proxy:指定代理服务器地址-X/--requestcommand>:向服务器发送指定请求方法-U/--proxy-user:代理服务器用户和密码-T:选项可将指定的本地文件上传到FTP服务器上--data/-d:方式指定使用POST方式传递数据-bname=data:从服务器响应set-cookie得到值,返回给服务器curl命令测试HTTP协议实战案例

1>.”-A/–user-agent “案例

[root@node101.yinzhengjie.org.cn~]#curl-A'Chrome/78.0.3904.108Safari/537.36'http://node107.yinzhengjie.org.cn#设置用户代理发送给服务器,其实就是封装了请求报文中的"User-Agent"参数,可以结合"-v"选项查看的更详细。尹正杰到此一游[root@node101.yinzhengjie.org.cn~]#[root@node101.yinzhengjie.org.cn~]#curl--user-agent'Firefox/108'http://node107.yinzhengjie.org.cn尹正杰到此一游[root@node101.yinzhengjie.org.cn~]#

[root@node107.yizhengjie.org.cn~]#ss-tnlStateRecv-QSend-QLocalAddress:PortPeerAddress:PortLISTEN0128*:80*:*LISTEN0128*:22*:*LISTEN0128:::22:::*[root@node107.yizhengjie.org.cn~]#[root@node107.yizhengjie.org.cn~]#ll/var/www/html/index.html-rw-r--r--1rootroot31Dec1022:17/var/www/html/index.html[root@node107.yizhengjie.org.cn~]#[root@node107.yizhengjie.org.cn~]#cat/var/www/html/index.html尹正杰到此一游[root@node107.yizhengjie.org.cn~]#[root@node107.yizhengjie.org.cn~]#tail-10f/var/log/httpd/access_log#查看服务端日志,观察请求日志信息......172.30.1.101--[10/Dec/2019:22:22:42+0800]"GET/HTTP/1.1"20031"-""Chrome/78.0.3904.108Safari/537.36"172.30.1.101--[10/Dec/2019:22:27:59+0800]"GET/HTTP/1.1"20031"-""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.108Safari/537.36'http://node107.yinzhengjie.org.cn-v#显示http请求的通信过程,包括request,response,以及正文。*Abouttoconnect()tonode107.yinzhengjie.org.cnport80(#0)*Trying172.30.1.107...*Connectedtonode107.yinzhengjie.org.cn(172.30.1.107)port80(#0)>GET/HTTP/1.1>User-Agent:Chrome/78.0.3904.108Safari/537.36>Host:node107.yinzhengjie.org.cn>Accept:*/*>"1f-5995a2a997640"尹正杰到此一游*Connection#0tohostnode107.yinzhengjie.org.cnleftintact[root@node101.yinzhengjie.org.cn~]#[root@node101.yinzhengjie.org.cn~]#

3>.”-e/–referer “案例

[root@node101.yinzhengjie.org.cn~]#curl-e"www.baidu.com"http://node107.yinzhengjie.org.cn-v#指定来源网址为"www.baidu.com"*Abouttoconnect()tonode107.yinzhengjie.org.cnport80(#0)*Trying172.30.1.107...*Connectedtonode107.yinzhengjie.org.cn(172.30.1.107)port80(#0)>GET/HTTP/1.1>User-Agent:curl/7.29.0>Host:node107.yinzhengjie.org.cn>Accept:*/*>Referer:www.baidu.com>"1f-5995a2a997640"尹正杰到此一游*Connection#0tohostnode107.yinzhengjie.org.cnleftintact[root@node101.yinzhengjie.org.cn~]#

[root@node107.yizhengjie.org.cn~]#ss-tnlStateRecv-QSend-QLocalAddress:PortPeerAddress:PortLISTEN0128*:80*:*LISTEN0128*:22*:*LISTEN0128:::22:::*[root@node107.yizhengjie.org.cn~]#[root@node107.yizhengjie.org.cn~]#ll/var/www/html/index.html-rw-r--r--1rootroot31Dec1022:17/var/www/html/index.html[root@node107.yizhengjie.org.cn~]#[root@node107.yizhengjie.org.cn~]#cat/var/www/html/index.html尹正杰到此一游[root@node107.yizhengjie.org.cn~]#[root@node107.yizhengjie.org.cn~]#tail-10f/var/log/httpd/access_log#查看服务端日志,观察请求日志信息......172.30.1.101--[10/Dec/2019:22:45:15+0800]"GET/HTTP/1.1"20031"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-Ihttp://node107.yinzhengjie.org.cn#只显示响应报文首部信息HTTP/1.1200OKDate:Tue,10Dec201914:52:36GMTServer:Apache/2.4.6(CentOS)PHP/5.4.16Last-Modified:Tue,10Dec201914:17:04GMTETag:"1f-5995a2a997640"Accept-Ranges:bytesContent-Length:31Content-Type:text/html;charset=UTF-8[root@node101.yinzhengjie.org.cn~]#[root@node101.yinzhengjie.org.cn~]#curl--headhttp://node107.yinzhengjie.org.cnHTTP/1.1200OKDate:Tue,10Dec201914:52:45GMTServer:Apache/2.4.6(CentOS)PHP/5.4.16Last-Modified:Tue,10Dec201914:17:04GMTETag:"1f-5995a2a997640"Accept-Ranges:bytesContent-Length:31Content-Type:text/html;charset=UTF-8[root@node101.yinzhengjie.org.cn~]#

[root@node107.yizhengjie.org.cn~]#ss-tnlStateRecv-QSend-QLocalAddress:PortPeerAddress:PortLISTEN0128*:80*:*LISTEN0128*:22*:*LISTEN0128:::22:::*[root@node107.yizhengjie.org.cn~]#[root@node107.yizhengjie.org.cn~]#ll/var/www/html/index.html-rw-r--r--1rootroot31Dec1022:17/var/www/html/index.html[root@node107.yizhengjie.org.cn~]#[root@node107.yizhengjie.org.cn~]#cat/var/www/html/index.html尹正杰到此一游[root@node107.yizhengjie.org.cn~]#[root@node107.yizhengjie.org.cn~]#tail-10f/var/log/httpd/access_log#查看服务端日志,观察请求日志信息......172.30.1.101--[10/Dec/2019:22:52:36+0800]"HEAD/HTTP/1.1"200-"-""curl/7.29.0"172.30.1.101--[10/Dec/2019:22:52:45+0800]"HEAD/HTTP/1.1"200-"-""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-ihttp://node107.yinzhengjie.org.cn#显示页面内容,包括报文首部信息HTTP/1.1200OKDate:Tue,10Dec201914:54:52GMTServer:Apache/2.4.6(CentOS)PHP/5.4.16Last-Modified:Tue,10Dec201914:17:04GMTETag:"1f-5995a2a997640"Accept-Ranges:bytesContent-Length:31Content-Type:text/html;charset=UTF-8尹正杰到此一游[root@node101.yinzhengjie.org.cn~]#[root@node101.yinzhengjie.org.cn~]#

[root@node107.yizhengjie.org.cn~]#ss-tnlStateRecv-QSend-QLocalAddress:PortPeerAddress:PortLISTEN0128*:80*:*LISTEN0128*:22*:*LISTEN0128:::22:::*[root@node107.yizhengjie.org.cn~]#[root@node107.yizhengjie.org.cn~]#ll/var/www/html/index.html-rw-r--r--1rootroot31Dec1022:17/var/www/html/index.html[root@node107.yizhengjie.org.cn~]#[root@node107.yizhengjie.org.cn~]#cat/var/www/html/index.html尹正杰到此一游[root@node107.yizhengjie.org.cn~]#[root@node107.yizhengjie.org.cn~]#tail-10f/var/log/httpd/access_log#查看服务端日志,观察请求日志信息......172.30.1.101--[10/Dec/2019:22:54:52+0800]"GET/HTTP/1.1"20031"-""curl/7.29.0"

[root@node107.yizhengjie.org.cn ~]# tail -10f /var/log/httpd/access_log               #查看服务端日志,观察请求日志信息,观察服务端是否有上面记录中的User-Agent参数记录。

6>.”–cacert “案例

[root@node101.yinzhengjie.org.cn~]#curlhttps://www.yinzhengjie.org.cn--cacert/etc/httpd/conf.d/ssl/cacert.pem#使用证书检查访问网页尹正杰到此一游[root@node101.yinzhengjie.org.cn~]#

7>.”-k/–insecure”案例

[root@node101.yinzhengjie.org.cn~]#curl-khttps://www.yinzhengjie.org.cn--cacert/etc/httpd/conf.d/ssl/cacert.pem#忽略证书检查访问网页尹正杰到此一游[root@node101.yinzhengjie.org.cn~]#

8>.”-c/–cookie-jar “案例

复制代码

[root@node101.yinzhengjie.org.cn~]#curl-c/root/cookie.txthttp://node107.yinzhengjie.org.cn/setcookie.php#将url中cookie存放在指定文件中[root@node101.yinzhengjie.org.cn~]#[root@node101.yinzhengjie.org.cn~]#cat/root/cookie.txt#NetscapeHTTPCookieFile#http://curl.haxx.se/docs/http-cookies.html#Thisfilewasgeneratedbylibcurl!Editatyourownrisk.node107.yinzhengjie.org.cnFALSE/FALSE0departmentITnode107.yinzhengjie.org.cnFALSE/FALSE1575993782userJason[root@node101.yinzhengjie.org.cn~]#

9>.”-X/–request “案例

[root@node101.yinzhengjie.org.cn~]#curl-XPUTwww.baidu.com#向服务端发送指定请求的方法,此处我们指定的方法是PUT,下面依次提交的方法是GET,DELETE以及POST方法。[root@node101.yinzhengjie.org.cn~]#[root@node101.yinzhengjie.org.cn~]#curl-XGETwww.baidu.com[root@node101.yinzhengjie.org.cn~]#[root@node101.yinzhengjie.org.cn~]#curl-XDELETEwww.baidu.com[root@node101.yinzhengjie.org.cn~]#[root@node101.yinzhengjie.org.cn~]#curl-XPOSTwww.baidu.com[root@node101.yinzhengjie.org.cn~]#

10>.”-D/–dump-header “案例

[root@node101.yinzhengjie.org.cn~]#lltotal0[root@node101.yinzhengjie.org.cn~]#[root@node101.yinzhengjie.org.cn~]#curl-Dyinzhengjie.htmlhttp://node107.yinzhengjie.org.cn#显示整个网页数据,并将响应头信息存入yinzhengjie.html尹正杰到此一游[root@node101.yinzhengjie.org.cn~]#[root@node101.yinzhengjie.org.cn~]#lltotal4-rw-r--r--1rootroot252Dec1023:35yinzhengjie.html[root@node101.yinzhengjie.org.cn~]#[root@node101.yinzhengjie.org.cn~]#catyinzhengjie.htmlHTTP/1.1200OKDate:Tue,10Dec201915:35:18GMTServer:Apache/2.4.6(CentOS)PHP/5.4.16Last-Modified:Tue,10Dec201914:17:04GMTETag:"1f-5995a2a997640"Accept-Ranges:bytesContent-Length:31Content-Type:text/html;charset=UTF-8[root@node101.yinzhengjie.org.cn~]#[root@node101.yinzhengjie.org.cn~]#

11>.”-u/–user [user:password]“案例

如下图所示,我用自己的用户名登陆我们公司的OA账号信息。

12>.查看帮助

[root@node101.yinzhengjie.org.cn~]#curl--helpUsage:curl[options...]Options:(H)meansHTTP/HTTPSonly,(F)meansFTPonly--anyauthPick"any"authenticationmethod(H)-a,--appendAppendtotargetfilewhenuploading(F/SFTP)--basicUseHTTPBasicAuthentication(H)--cacertFILECAcertificatetoverifypeeragainst(SSL)--capathDIRCAdirectorytoverifypeeragainst(SSL)-E,--certCERT[:PASSWD]Clientcertificatefileandpassword(SSL)--cert-typeTYPECertificatefiletype(DER/PEM/ENG)(SSL)--ciphersLISTSSLcipherstouse(SSL)--compressedRequestcompressedresponse(usingdeflateorgzip)-K,--configFILESpecifywhichconfigfiletoread--connect-timeoutSECONDSMaximumtimeallowedforconnection-C,--continue-atOFFSETResumedtransferoffset-b,--cookieSTRING/FILEStringorfiletoreadcookiesfrom(H)-c,--cookie-jarFILEWritecookiestothisfileafteroperation(H)--create-dirsCreatenecessarylocaldirectoryhierarchy--crlfConvertLFtoCRLFinupload--crlfileFILEGetaCRLlistinPEMformatfromthegivenfile-d,--dataDATAHTTPPOSTdata(H)--data-asciiDATAHTTPPOSTASCIIdata(H)--data-binaryDATAHTTPPOSTbinarydata(H)--data-urlencodeDATAHTTPPOSTdataurlencoded(H)--delegationSTRINGGSS-APIdelegationpermission--digestUseHTTPDigestAuthentication(H)--disable-eprtInhibitusingEPRTorLPRT(F)--disable-epsvInhibitusingEPSV(F)-D,--dump-headerFILEWritetheheaderstothisfile--egd-fileFILEEGDsocketpathforrandomdata(SSL)--engineENGINGECryptoengine(SSL)."--enginelist"forlist-f,--failFailsilently(nooutputatall)onHTTPerrors(H)-F,--formCONTENTSpecifyHTTPmultipartPOSTdata(H)--form-stringSTRINGSpecifyHTTPmultipartPOSTdata(H)--ftp-accountDATAAccountdatastring(F)--ftp-alternative-to-userCOMMANDStringtoreplace"USER[name]"(F)--ftp-create-dirsCreatetheremotedirsifnotpresent(F)--ftp-method[MULTICWD/NOCWD/SINGLECWD]ControlCWDusage(F)--ftp-pasvUsePASV/EPSVinsteadofPORT(F)-P,--ftp-portADRUsePORTwithgivenaddressinsteadofPASV(F)--ftp-skip-pasv-ipSkiptheIPaddressforPASV(F)--ftp-pretSendPRETbeforePASV(fordrftpd)(F)--ftp-ssl-cccSendCCCafterauthenticating(F)--ftp-ssl-ccc-modeACTIVE/PASSIVESetCCCmode(F)--ftp-ssl-controlRequireSSL/TLSforftplogin,clearfortransfer(F)-G,--getSendthe-ddatawithaHTTPGET(H)-g,--globoffDisableURLsequencesandrangesusing{}and[]-H,--headerLINECustomheadertopasstoserver(H)-I,--headShowdocumentinfoonly-h,--helpThishelptext--hostpubmd5MD5HexencodedMD5stringofthehostpublickey.(SSH)-0,--http1.0UseHTTP1.0(H)--ignore-content-lengthIgnoretheHTTPContent-Lengthheader-i,--includeIncludeprotocolheadersintheoutput(H/F)-k,--insecureAllowconnectionstoSSLsiteswithoutcerts(H)--interfaceINTERFACESpecifynetworkinterface/addresstouse-4,--ipv4ResolvenametoIPv4address-6,--ipv6ResolvenametoIPv6address-j,--junk-session-cookiesIgnoresessioncookiesreadfromfile(H)--keepalive-timeSECONDSIntervalbetweenkeepaliveprobes--keyKEYPrivatekeyfilename(SSL/SSH)--key-typeTYPEPrivatekeyfiletype(DER/PEM/ENG)(SSL)--krbLEVELEnableKerberoswithspecifiedsecuritylevel(F)--libcurlFILEDumplibcurlequivalentcodeofthiscommandline--limit-rateRATELimittransferspeedtothisrate-l,--list-onlyListonlynamesofanFTPdirectory(F)--local-portRANGEForceuseoftheselocalportnumbers-L,--locationFollowredirects(H)--location-trustedlike--locationandsendauthtootherhosts(H)-M,--manualDisplaythefullmanual--mail-fromFROMMailfromthisaddress--mail-rcptTOMailtothisreceiver(s)--mail-authAUTHOriginatoraddressoftheoriginalemail--max-filesizeBYTESMaximumfilesizetodownload(H/F)--max-redirsNUMMaximumnumberofredirectsallowed(H)-m,--max-timeSECONDSMaximumtimeallowedforthetransfer--metalinkProcessgivenURLsasmetalinkXMLfile--negotiateUseHTTPNegotiateAuthentication(H)-n,--netrcMustread.netrcforusernameandpassword--netrc-optionalUseeither.netrcorURL;overrides-n--netrc-fileFILESetupthenetrcfilenametouse-N,--no-bufferDisablebufferingoftheoutputstream--no-keepaliveDisablekeepaliveuseontheconnection--no-sessionidDisableSSLsession-IDreusing(SSL)--noproxyListofhostswhichdonotuseproxy--ntlmUseHTTPNTLMauthentication(H)-o,--outputFILEWriteoutputtoinsteadofstdout--passPASSPassphrasefortheprivatekey(SSL/SSH)--post301DonotswitchtoGETafterfollowinga301redirect(H)--post302DonotswitchtoGETafterfollowinga302redirect(H)--post303DonotswitchtoGETafterfollowinga303redirect(H)-#,--progress-barDisplaytransferprogressasaprogressbar--protoPROTOCOLSEnable/disablespecifiedprotocols--proto-redirPROTOCOLSEnable/disablespecifiedprotocolsonredirect-x,--proxy[PROTOCOL://]HOST[:PORT]Useproxyongivenport--proxy-anyauthPick"any"proxyauthenticationmethod(H)--proxy-basicUseBasicauthenticationontheproxy(H)--proxy-digestUseDigestauthenticationontheproxy(H)--proxy-negotiateUseNegotiateauthenticationontheproxy(H)--proxy-ntlmUseNTLMauthenticationontheproxy(H)-U,--proxy-userUSER[:PASSWORD]Proxyuserandpassword--proxy1.0HOST[:PORT]UseHTTP/1.0proxyongivenport-p,--proxytunnelOperatethroughaHTTPproxytunnel(usingCONNECT)--pubkeyKEYPublickeyfilename(SSH)-Q,--quoteCMDSendcommand(s)toserverbeforetransfer(F/SFTP)--random-fileFILEFileforreadingrandomdatafrom(SSL)-r,--rangeRANGERetrieveonlythebyteswithinarange--rawDoHTTP"raw",withoutanytransferdecoding(H)-e,--refererRefererURL(H)-J,--remote-header-nameUsetheheader-providedfilename(H)-O,--remote-nameWriteoutputtoafilenamedastheremotefile--remote-name-allUsetheremotefilenameforallURLs-R,--remote-timeSettheremotefile'stimeonthelocaloutput-X,--requestCOMMANDSpecifyrequestcommandtouse--resolveHOST:PORT:ADDRESSForceresolveofHOST:PORTtoADDRESS--retryNUMRetryrequestNUMtimesiftransientproblemsoccur--retry-delaySECONDSWhenretrying,waitthismanysecondsbetweeneach--retry-max-timeSECONDSRetryonlywithinthisperiod-S,--show-errorShowerror.With-s,makecurlshowerrorswhentheyoccur-s,--silentSilentmode.Don'toutputanything--socks4HOST[:PORT]SOCKS4proxyongivenhost+port--socks4aHOST[:PORT]SOCKS4aproxyongivenhost+port--socks5HOST[:PORT]SOCKS5proxyongivenhost+port--socks5-basicEnableusername/passwordauthforSOCKS5proxies--socks5-gssapiEnableGSS-APIauthforSOCKS5proxies--socks5-hostnameHOST[:PORT]SOCKS5proxy,passhostnametoproxy--socks5-gssapi-serviceNAMESOCKS5proxyservicenameforgssapi--socks5-gssapi-necCompatibilitywithNECSOCKS5server-Y,--speed-limitRATEStoptransfersbelowspeed-limitfor'speed-time'secs-y,--speed-timeSECONDSTimefortrigspeed-limitabort.Defaultsto30--sslTrySSL/TLS(FTP,IMAP,POP3,SMTP)--ssl-reqdRequireSSL/TLS(FTP,IMAP,POP3,SMTP)-2,--sslv2UseSSLv2(SSL)-3,--sslv3UseSSLv3(SSL)--ssl-allow-beastAllowsecurityflawtoimproveinterop(SSL)--stderrFILEWheretoredirectstderr.-meansstdout--tcp-nodelayUsetheTCP_NODELAYoption-t,--telnet-optionOPT=VALSettelnetoption--tftp-blksizeVALUESetTFTPBLKSIZEoption(mustbe>512)-z,--time-condTIMETransferbasedonatimecondition-1,--tlsv1Use=>TLSv1(SSL)--tlsv1.0UseTLSv1.0(SSL)--tlsv1.1UseTLSv1.1(SSL)--tlsv1.2UseTLSv1.2(SSL)--traceFILEWriteadebugtracetothegivenfile--trace-asciiFILELike--tracebutwithoutthehexoutput--trace-timeAddtimestampstotrace/verboseoutput--tr-encodingRequestcompressedtransferencoding(H)-T,--upload-fileFILETransferFILEtodestination--urlURLURLtoworkwith-B,--use-asciiUseASCII/texttransfer-u,--userUSER[:PASSWORD]Serveruserandpassword--tlsuserUSERTLSusername--tlspasswordSTRINGTLSpassword--tlsauthtypeSTRINGTLSauthenticationtype(defaultSRP)--unix-socketFILEConnectthroughthisUNIXdomainsocket-A,--user-agentSTRINGUser-Agenttosendtoserver(H)-v,--verboseMaketheoperationmoretalkative-V,--versionShowversionnumberandquit-w,--write-outFORMATWhattooutputaftercompletion--xattrStoremetadatainextendedfileattributes-qIfusedasthefirstparameterdisables.curlrc[root@node101.yinzhengjie.org.cn~]#re

[root@node101.yinzhengjie.org.cn ~]# curl –help

elinks工具

1>.安装elinks工具

[root@node101.yinzhengjie.org.cn~]#yum-yinstallelinksLoadedplugins:fastestmirrorLoadingmirrorspeedsfromcachedhostfileepel/x86_64/metalink|8.6kB00:00:00*base:mirrors.huaweicloud.com*epel:mirrors.tuna.tsinghua.edu.cn*extras:mirrors.huaweicloud.com*updates:mirrors.huaweicloud.combase|3.6kB00:00:00epel|5.3kB00:00:00extras|2.9kB00:00:00updates|2.9kB00:00:00(1/2):epel/x86_64/primary_db|6.9MB00:00:02(2/2):epel/x86_64/updateinfo|1.0MB00:00:05ResolvingDependencies-->Runningtransactioncheck--->Packageelinks.x86_640:0.12-0.37.pre6.el7.0.1willbeinstalled-->ProcessingDependency:libnss_compat_ossl.so.0()(64bit)forpackage:elinks-0.12-0.37.pre6.el7.0.1.x86_64-->ProcessingDependency:libmozjs185.so.1.0()(64bit)forpackage:elinks-0.12-0.37.pre6.el7.0.1.x86_64-->Runningtransactioncheck--->Packagejs.x86_641:1.8.5-20.el7willbeinstalled--->Packagenss_compat_ossl.x86_640:0.9.6-8.el7willbeinstalled-->FinishedDependencyResolutionDependenciesResolved=============================================================================================================================================PackageArchVersionRepositorySize=============================================================================================================================================Installing:elinksx86_640.12-0.37.pre6.el7.0.1base882kInstallingfordependencies:jsx86_641:1.8.5-20.el7base2.3Mnss_compat_osslx86_640.9.6-8.el7base37kTransactionSummary=============================================================================================================================================Install1Package(+2Dependentpackages)Totaldownloadsize:3.2MInstalledsize:9.6MDownloadingpackages:(1/3):elinks-0.12-0.37.pre6.el7.0.1.x86_64.rpm|882kB00:00:00(2/3):js-1.8.5-20.el7.x86_64.rpm|2.3MB00:00:00(3/3):nss_compat_ossl-0.9.6-8.el7.x86_64.rpm|37kB00:00:00---------------------------------------------------------------------------------------------------------------------------------------------Total5.4MB/s|3.2MB00:00:00RunningtransactioncheckRunningtransactiontestTransactiontestsucceededRunningtransactionInstalling:nss_compat_ossl-0.9.6-8.el7.x86_641/3Installing:1:js-1.8.5-20.el7.x86_642/3Installing:elinks-0.12-0.37.pre6.el7.0.1.x86_643/3Verifying:elinks-0.12-0.37.pre6.el7.0.1.x86_641/3Verifying:1:js-1.8.5-20.el7.x86_642/3Verifying:nss_compat_ossl-0.9.6-8.el7.x86_643/3Installed:elinks.x86_640:0.12-0.37.pre6.el7.0.1DependencyInstalled:js.x86_641:1.8.5-20.el7nss_compat_ossl.x86_640:0.9.6-8.el7Complete![root@node101.yinzhengjie.org.cn~]#

[root@node101.yinzhengjie.org.cn ~]# yum -y install elinks

2>.使用elinks访问网页

[root@node101.yinzhengjie.org.cn~]#elinkshttp://node107.yinzhengjie.org.cn#执行该命令后会弹出一个字符界面的对话框。

img

3>.使用”-source”选项

[root@node101.yinzhengjie.org.cn~]#elinks-sourcehttp://node107.yinzhengjie.org.cn#可以打印网页源码尹正杰到此一游[root@node101.yinzhengjie.org.cn~]#

4>.使用”-dump:”选项案例

[root@node101.yinzhengjie.org.cn~]#elinks-dumphttp://node107.yinzhengjie.org.cn#非交互式模式,将URL的内容输出至标准输出尹正杰到此一游[root@node101.yinzhengjie.org.cn~]#

感谢你能够认真阅读完这篇文章,希望小编分享的“Linux系统中如何使用curl命令”这篇文章对大家有帮助,同时也希望大家多多支持亿速云,关注亿速云行业资讯频道,更多相关知识等着你来学习!