Testing Web Access and network-related commands under Linux

Source: Internet
Author: User
Tags http 200 domain name server traceroute command

Curl Command

Curl is a tool for simple testing of Web Access under the Linux system command line.

Curl-xip:port www.baidu.com-x can specify IP and port, omit write hosts, convenient and practical

-I show status codes only

-V shows detailed process, visual operation;

-U Specify user name and password

-O download Web file

-O Custom Download file name

[Email protected] ~]# curl-x61.135.157.156:80 www.qq.com-IHTTP/1.1 Okserver:squid/3.4.1date:mon, APR 2015 13:5 7:51 gmtcontent-type:text/html; Charset=gb2312connection:keep-alivevary:accept-encodingexpires:mon, APR 13:58:51 gmtcache-control:max-age= 60vary:accept-encodingx-cache:hit from tianjin.qq.com

HTTP 200 represents a normal web page.


Curl-iv Www.qq.com-I can drop the content of the access, only show the status code,-V can show the detailed process

[[Email protected] ~]# curl -iv www.qq.com* about to connect ()  to  www.qq.com port 80  (#0) *   trying 180.96.86.192... connected*  Connected to www.qq.com  (180.96.86.192)  port 80  (#0) > head /  HTTP/1.1> User-Agent: curl/7.19.7  (I386-REDHAT-LINUX-GNU)  libcurl/7.19.7 nss /3.16.2.3 basic ecc zlib/1.2.3 libidn/1.18 libssh2/1.4.2> host:  www.qq.com> accept: */*> < http/1.1 200 okhttp/1.1 200 ok<  server: squid/3.4.1server: squid/3.4.1< date: fri, 24 apr 2015  01:38:47 gmtdate: fri, 24 apr 2015 01:38:47 gmt< content-type :  text/html; charset=gb2312content-type: text/html; charset=gb2312< connection:  keep-aliveconnection: keep-alive< vary: accept-encodingvary: accept-encoding< expires: fri,  24 apr 2015 01:39:47 gmtexpires: fri, 24 apr 2015 01:39:47  gmt< cache-control: max-age=60cache-control: max-age=60< vary:  Accept-encodingvary: accept-encoding< x-cache: hit from nanjing.qq.comx-cache:  HIT from nanjing.qq.com< * Connection  #0  to host www.qq.com  left intact* Closing connection  #0


Curl-u User:password www.hao123.com-u can specify user name and password


Use-o to download Web pages;

example, download 51cto blog page, download the file is HTML document;

[[email protected] ~]# curl http://8802265.blog.51cto.com/8792265/1636847 -o   % total    % received % xferd  average speed    Time    Time     Time  Current                                   dload  upload    total   spent    left  speed100 68527     0 68527    0     0    176k      0 --:--:-- --:--:-- --:--:--  224k[[email  protected] ~]# file 1636847 1636847: iso-8859 html document text , &NBSP;WITH&NBSP;VERY&NBSP;LONG&Nbsp;lines[[email protected] ~]# ls -l-rw-r--r--  1 root root    68527 apr 24 09:38 1636847


You can also use the-o custom download name

[[email protected] ~]# curl http://8802265.blog.51cto.com/8792265/1636847 -o  Blog.html  % total    % received % xferd  average  Speed   Time    Time     Time   current                                  Dload   upload   total   spent    left  speed100  68527    0 68527    0     0   87925      0 --:--:-- --:--:-- --:--:--    98k[[email protected] ~]# ls -l blog.html -rw-r--r-- 1 root root  68527 apr 24&Nbsp;09:43 blog.html 



Several network-related commands under Linux

Ping Test Network is

Format: Ping www.baidu.com-c 3-c parameter specifies the number of pings

[[email protected] ~]# ping www.baidu.com-c 3PING www.a.shifen.com (180.97.33.108) (+) bytes of data.64 bytes from 180 .97.33.108:icmp_seq=1 ttl=53 time=32.6 ms64 bytes from 180.97.33.108:icmp_seq=2 ttl=53 time=28.5 ms64 bytes from 180.97.  33.108:icmp_seq=3 ttl=53 time=29.2 ms---www.a.shifen.com PING statistics---3 packets transmitted, 3 received, 0% packet Loss, time 2034msrtt Min/avg/max/mdev = 28.558/30.130/32.623/1.788 ms


Telnet test port is open

Install telnet command: Yum install-y telnet

Example, access Baidu's 80 port can be connected, 3389 port is off;

[[Email protected] ~]# telnet www.qq.com 80Trying 180.96.86.192...Connected to Www.qq.comEscape character is ' ^] '.
[[Email protected] ~]# telnet www.qq.com 3389Trying 180.96.86.192...telnet:connect to address 180.96.86.192:connection t Imed outtrying 240e:e1:8100:28::2:16...telnet:connect to address 240e:e1:8100:28::2:16:network is unreachable


Traceroute Trace Routing Table

Install traceroute command: Yum install-y traceroute

[[email protected] ~]# traceroute www.qq.comtraceroute to www.qq.com  ( 180.96.86.192),  30 hops max, 60 byte packets 1  192.168.20.1   (192.168.20.1)   1.397 ms * * 2  192.168.4.1  (192.168.4.1)   2.950 ms  2.415 ms  2.930 ms 3  113.116.76.1   (113.116.76.1)   5.948 ms  5.539 ms  5.138 ms 4   113.106.43.101  (113.106.43.101)   3.044 ms  3.567 ms  3.901  ms 5  219.133.30.238  (219.133.30.238)   3.454 ms  3.070  ms  2.654 ms 6  183.56.65.86  (183.56.65.86)   6.279 ms   5.681 ms 183.56.66.2  (183.56.66.2)   4.197 ms 7   202.97.48.109  (202.97.48.109)   26.995 ms  26.693 ms  27.072 ms 8  61.160.134.26  (61.160.134.26)   442.708 ms  442.285 ms  440.784 ms 9   202.102.69.206  (202.102.69.206)   24.608 ms 202.102.69.202  (202.102.69.202)   28.271 ms 202.102.73.14  (202.102.73.14)   30.530 ms10   180.96.48.6  (180.96.48.6)   23.971 ms 180.96.51.102  (180.96.51.102)    27.870 ms  27.521 ms11  180.96.35.182  (180.96.35.182)   25.203  ms 180.96.48.206  (180.96.48.206)   23.814 ms 180.96.35.182  ( 180.96.35.182)   25.058 ms12  * * *13  * * *14   * * *15  * * *16  * * *17  * * *18   * * *19  * * *20  * * *21  * * *22  * * *23   * * *24  * * *25  * * *26  * *  *27  * * *28  * * *29  * * *30  *  * *



dig, Full Name Domain information Groper, a flexible tool for asking DNS, displays the replies returned from the requested domain name server. The same functionality as the Nslookup inside windows.

Install dig command: Yum install-y bind-utils

How to use: dig @ domain Name server www.baidu.com

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/E/U261/LANG/ZH-CN /images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>[[email protected] ~]# dig @114.114.114.114 www.qq.com

; <<>> dig 9.8.2rc1-redhat-9.8.2-0.30.rc1.el6 _6.2 <<>> @114.114.114.114 www.qq.com;  (1 server found);  global options: +cmd;;  Got answer:;;  ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9644;;  flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0,  additional: 0;;  QUESTION SECTION:;www.qq.com.INA;;  ANSWER SECTION:www.qq.com.181INA14.17.42.40www.qq.com.181INA59.37.96.63www.qq.com.181INA14.17.32.211;;  Query time: 46 msec;;  server: 114.114.114.114#53 (114.114.114.114);  WHEN: Fri Apr 24 09:53:01 2015;;  msg size  rcvd: 76 


NC (NETCAT) powerful network tool, scan port;

command to install NC: Yum install-y NC

format: nc-z-w2-v www.baidu.com 1-1024  

-W2 indicates a 2s timeout; Port can write only one port, or write a range. When using the NC scan port, you must add-Z (turn the input and output off) otherwise the result will not be displayed. -V Displays the details and displays the ports that are not open;

[Email protected] ~]# nc-z-w2 www.baidu.com 80Connection to www.baidu.com Port [Tcp/http] succeeded!  [Email protected] ~]# nc-z-v-w2 www.baidu.com 20-22nc:connect to www.baidu.com port (TCP) timed out:operation now In Progressnc:connect to www.baidu.com port (TCP) timed out:operation today in progressconnection to www.baidu.com 21 Port [Tcp/ftp] Succeeded!nc:connect to www.baidu.com Port A (TCP) timed out:operation now on progressnc:connect to www . Baidu.com port (TCP) timed out:operation now in progress




This article is from the "Model Student's Learning blog" blog, please be sure to keep this source http://8802265.blog.51cto.com/8792265/1637821

Testing Web Access and network-related commands under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.