经常使用命令行,比如curl来测试界面响应时间,foriin{1..10};docurl-o/dev/null-s-w》$i|time_namelookup:%{time_namelookup}|time_connect:%{time_connect}|time_starttransfer:%{time_starttransfer}|time_total:%{time_total}""http://httpbin.org/ip";done1|time_namelookup:0.016000|time_connect:0.016000|time_starttransfer:0.125000|time_total:0.1410002|time_namelookup:0.016000|time_connect:0.016000|time_starttransfer:0.094000|time_total:0.1090003|time_namelookup:0.016000|time_connect:0.031000|time_starttransfer:0.109000|time_total:0.1090004|time_namelookup:0.015000|time_connect:0.031000|time_starttransfer:0.109000|time_total:0.1090005|time_namelookup:0.031000|time_connect:0.031000|time_starttransfer:0.109000|time_total:0.1090006|time_namelookup:0.016000|time_connect:0.016000|time_starttransfer:0.094000|time_total:0.1090007|time_namelookup:0.016000|time_connect:0.016000|time_starttransfer:0.125000|提姆e_total:0.1250008|time_namelookup:0.000001|time_connect:0.016000|time_starttransfer:0.141000|time_total:0.1410009|time_namelookup:0.015000|time_connect:0.015000|time_starttransfer:0.093000|time_total:0.10900010|time_namelookup:0.000001|time_connect:0.015000|time_starttransfer:0.109000|time_total:0.125000奈何命令行参数太太多了,记不住怎么办?这时候你需要一个男人,就是男人man#mancurlcurl(1)CurlManualcurl(1)NAMEcurl-transferaURLSYNOPSIScurl[options][URL...]DESCRIPTIONcurlisatooltotransferdatafromortoaserver,usingoneofthesupportedprotocols(DICT,FILE,FTP,FTPS,GOPHER,HTTP,HTTPS,IMAP,IMAPS,LDAP,LDAPS,POP3,POP3S,RTMP,RTSP,SCP,SFTP,SMTP,SMTPS,TELNETandTFTP).Thecommandisdesignedtoworkwithoutuserinteraction.curloffersabusloadofusefultrickslikeproxysupport,userauthentication,FTPupload,HTTPpost,SSLconnections,cookies,filetransferresume,Metalink,andmore.Asyouwillseebelow,thenumberoffeatureswillmakeyourheadspin!curlispoweredbylibcurlforalltransfer-relatedfeatures.Seelibcurl(3)fordetails.URL的URL语法依赖于协议。你会在RFC3986中找到详细的描述。你可以通过在大括号中写入部分集来指定多个URL或URL的部分:http://site.{one,two,three}.com或者你可以通过使用[]asin:ftp://ftp.numericals.com/file[1-100].txtftp://ftp.numericals.com/file[001-100].txt(withleadingzeros)ftp://ftp.letters.com/file[a-z].txt人确实很坚强,给出了很多提示,但我真的不想要。.还是不知道怎么用。相信大家在技术文章中经常会看到TL;DR,也就是TooLong;没读过。太长的话mancurl的内容太长了,就不看了。这个就是比较强的mantldr,它是一个命令行工具,可以直接使用npminstall-gtldr安装。tldr[root@VM_0_14_centos~]#npminstall-gtldr/usr/local/n/versions/node/11.4.0/bin/tldr->/usr/local/n/versions/node/11.4.0/lib/node_modules/tldr/bin/tldr+tldr@3.2.7added113packagesfrom103contributorsin60.759s╭────────────────────────────────────────────────────────────────────────╮│││npm可用的新次要版本!6.4.1→6.9.0││变更日志:https://github。com/npm/cli/releases/tag/v6.9.0││Runnpminstall-gnpmtoupdate!│││╰────────────────────────────────────────────────────────────────────────╯安装后,让我们看看如何自己使用tldr。$tldrtldrtldrSimplifiedmanpages.Moreinformation:.-Gettypicalusagesofacommand(hint:thisishowyougothere!):tldrcommand-Showthetartldrpageforlinux:tldr-plinuxtar-Gethelpforagitsubcommand:tldrgitcheckout小试牛刀下$tldr-plinuxtartarArchivingutility.Oftencombinedwithacompressionmethod,suchasgziporbzip.Moreinformation:.-Createanarchivefromfiles:tar-cftarget.tarfile1file2file3-创建压缩压缩文件:tar-czftarget.tar.gzfile1file2file3-在目标目录中提取压缩文件:tar-xfsource.tar-C目录-在当前目录中提取压缩压缩文件:tar-xzfsource.tar.gz-在当前目录中提取压缩压缩文件:tar-xjfsource.tar.bz2-创建压缩文件,使用压缩文件后缀确定压缩程序:tar-caftarget..xzfile1file2file3-Listthecontentsofatarfile:tar-tvfsource.tar-Extractfilesmatchingapattern:tar-xfsource.tar--wildcards"*.html"嗯,很简单,直接给出tar需要的参数,再来看curlλtldrcurlcurlTransfersdatafromortoaserver.Supports,includingmostHTTPtoaserver.SupportsFTP和POP3.-将URL的内容下载到文件:curlhttp://example.com-ofilename-下载文件,将输出保存在URL指示的文件名下:curl-Ohttp://example.com/filename-下载文件,遵循[L]位置重定向,并自动[C]继续(恢复)上一个文件传输:curl-O-L-C-http://example.com/filename-Sendform-encodeddata(POSTrequestoftypeapplication/x-www-form-urlencoded):curl-d'name=bob'http://example.com/form-Sendarequestwithanextraheader,使用自定义HTTP方法:curl-H'X-My-Header:123'-XPUThttp://example.com-以JSON格式发送数据,指定适当的内容类型标头:curl-d'{"name":"bob"}'-H'Content-Type:application/json'http://example.com/users/1234-Passausernameandpasswordforserverauthentication:curl-umyusername:mypasswordhttp://example.com-Passclientcertificateandkeyforaresource,skippingcertificatevalidation:curl--certclient.pem--keykey.pem--insecurehttps://example.com这个男人果然更坚强,经常用的curl命令都包了,我喜欢安装的命令除了内置命令外,还可以[root@VM_0_14_centos~]#tldrpythonpythonPython语言解释器。更多信息:https://www.python.org.-CallaPythoninteractiveshell(REPL):python-ExecutescriptinagivenPythonfile:pythonscript.py-Executescriptaspartofaninteractiveshell:python-iscript.py-ExecuteaPythonexpression:python-c"expression"-Runlibrarymoduleasascript(terminatesoptionlist):python-mmodulearguments-InteractivelydebugaPythonscript:python-mpdbscript.py除了node还有其他版本https://github.com/tldr-pages/tldr如Python,直接pipinstalltldr安装。如果不想安装tldr,也可以直接使用网页在线查看https://tldr.sh/有了tldr,妈妈再也不用担心我记不住命令行参数了。有比tldr更强壮的男人吗?可以,比如cheathttps://github.com/cheat/cheat,直接使用pipinstallcheat安装。cheat看看cheat怎么用吧$cheatcheat#Toseexampleusageofaprogram:cheat
