首页 > 代码库 > 工作中常用的几个命令
工作中常用的几个命令
1.查看主机DNS的命令:
1.1host可以查看域名所对应的IP,配置DNS的时候看看是否生效
[root@web02 ~]# host dev.xinfushe.com dev.xinfushe.com has address 124.205.3.180 [root@web02 ~]#
1.2nslookup不仅可以查看域名所对应的的IP,也可以查看是哪台服务器解析的
[root@web02 ~]# nslookup dev.xinfushe.com Server: 10.143.22.118 #DNS解析服务器 Address: 10.143.22.118#53 Non-authoritative answer: Name: dev.xinfushe.com Address: 124.205.3.180
2.远程查看端口的命令
这样是正常的 [root@web02 ~]# telnet 59.110.25.215 52222 Trying 59.110.25.215... Connected to 59.110.25.215. Escape character is ‘^]‘. SSH-2.0-OpenSSH_6.6.1 Protocol mismatch. Connection closed by foreign host. [root@web02 ~]# #这样代表的是端口可以没有开 [root@web02 ~]# telnet 59.110.25.215 22 Trying 59.110.25.215... telnet: connect to address 59.110.25.215: Connection refused [root@web02 ~]#
3.测试网络是否畅通ping
[root@web02 ~]# ping www.baidu.com PING www.a.shifen.com (115.239.210.27) 56(84) bytes of data. 64 bytes from 115.239.210.27: icmp_seq=1 ttl=55 time=26.2 ms 64 bytes from 115.239.210.27: icmp_seq=2 ttl=55 time=26.1 ms 64 bytes from 115.239.210.27: icmp_seq=3 ttl=55 time=26.2 ms ^C --- www.a.shifen.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2001ms rtt min/avg/max/mdev = 26.186/26.208/26.225/0.016 ms [root@web02 ~]#
4.查看网卡流量的软件(不求多但求精)
nload 网卡 #查看哪一个网卡
5.查看当前登陆的服务器用户
查看登陆服务器的人 [root@web02 ~]# who liuhaixiao pts/0 2017-01-02 11:32 (1.89.202.74)#从哪个IP登陆的,也就是源Ip以及时间 root pts/1 2017-01-02 11:49 (10.27.77.205) [root@web02 ~]# #查看当前我是谁 [root@web02 ~]# whoami root
6.扫描一台服务器的端口
[root@web01 ~]# nmap 59.110.26.9 Starting Nmap 6.40 ( http://nmap.org ) at 2017-01-02 11:54 CST Nmap scan report for 59.110.26.9 Host is up (0.00024s latency). Not shown: 998 closed ports PORT STATE SERVICE 80/tcp open http 3306/tcp open mysql #对外开方的端口 MAC Address: 00:16:3E:07:0C:0F (Xensource) Nmap done: 1 IP address (1 host up) scanned in 0.08 seconds
7.windows和linux查看路由TTL
C:\Users\刘海笑>tracert -d www.baidu.com 通过最多 30 个跃点跟踪 到 www.a.shifen.com [119.75.218.70] 的路由: 1 1 ms 1 ms 1 ms 192.168.199.1 2 17 ms 19 ms 15 ms 1.89.200.1 3 11 ms 12 ms 11 ms 10.1.65.221 4 36 ms 63 ms 17 ms 211.99.128.241 ^C C:\Users\刘海笑> [root@web01 ~]# traceroute www.baidu.com traceroute to www.baidu.com (115.239.211.112), 30 hops max, 60 byte packets 1 11.208.208.6 (11.208.208.6) 0.815 ms 0.826 ms 11.208.204.102 (11.208.204.102) 0.631 ms 2 11.208.204.102 (11.208.204.102) 0.655 ms 0.693 ms 11.208.208.6 (11.208.208.6) 0.804 ms 3 123.56.34.94 (123.56.34.94) 2.310 ms 2.305 ms 2.298 ms 4 101.200.109.146 (101.200.109.146) 1.945 ms 101.200.109.134 (101.200.109.134) 1.472 ms 101.200.109.130 (101.200.109.130) 1.521 ms 5 180.149.140.41 (180.149.140.41) 1.670 ms 180.149.140.81 (180.149.140.81) 1.090 ms 36.110.166.101 (36.110.166.101) 0.957 ms 6 180.149.128.194 (180.149.128.194) 4.467 ms 180.149.141.105 (180.149.141.105) 3.477 ms 218.30.25.221 (218.30.25.221) 1.845 ms 7 218.30.25.225 (218.30.25.225) 5.440 ms 218.30.28.29 (218.30.28.29) 2.727 ms 180.149.128.113 (180.149.128.113) 2.393 ms 8 202.97.68.122 (202.97.68.122) 35.474 ms 202.97.68.126 (202.97.68.126) 36.621 ms 202.97.68.166 (202.97.68.166) 28.776 ms 9 220.191.200.82 (220.191.200.82) 29.448 ms 220.191.200.146 (220.191.200.146) 34.813 ms 220.191.200.82 (220.191.200.82) 29.410 ms^C [root@web01 ~]#
8.刷新DNS的缓存,工作中经常切换DNS,所以得刷新本地的DNS
window刷新DNS配置 C:\Users\刘海笑>ipconfig/flushdns Windows IP 配置 已成功刷新 DNS 解析缓存。 C:\Users\刘海笑>
9.查看DNS解析过程
[root@web01 ~]# dig @8.8.8.8 www.baidu.com +trace ; <<>> DiG 9.9.4-RedHat-9.9.4-38.el7_3 <<>> @8.8.8.8 www.baidu.com +trace ; (1 server found) ;; global options: +cmd . 121551 IN NS d.root-servers.net. . 121551 IN NS b.root-servers.net. . 121551 IN NS h.root-servers.net. . 121551 IN NS i.root-servers.net. . 121551 IN NS l.root-servers.net. . 121551 IN NS c.root-servers.net. . 121551 IN NS e.root-servers.net. . 121551 IN NS g.root-servers.net. . 121551 IN NS m.root-servers.net. . 121551 IN NS a.root-servers.net. . 121551 IN NS f.root-servers.net. . 121551 IN NS j.root-servers.net. . 121551 IN NS k.root-servers.net. . 121551 IN RRSIG NS 8 0 518400 20170113050000 20161231040000 39291 . dDFhvwf2pRb5EQrlDsDt5ja2tE7fsf0UWR2of7pxfP7FZmD7QFYmWUdV pK4wbs7nD/DwmApgEa2oQYvj/+YP6JRz3WyLT/PowixJduOvbV04CWGt Ud3QK+dIHUUxp/WLU5JD35MAuEeXRbbaV3MVPDok19MsSgcfjDt/sAYT KVnbgV3Lfda2gVP5oxHqJoAwdRXcJTSTWcxYhpBi+sImacAo7QSlh3F/ 6l/y9nuKI3qxtlC24tTmmS11oadK7rW0b0q5B+PaicfuvibcYrq3kigo NDck9xzkWNGYe9VqAtfvsVnlwOgWCtoCoDIRhLGZk5yVXYyOmr6qBuY9 QewTzA== ;; Received 525 bytes from 8.8.8.8#53(8.8.8.8) in 61 ms com. 172800 IN NS f.gtld-servers.net. com. 172800 IN NS k.gtld-servers.net. com. 172800 IN NS e.gtld-servers.net. com. 172800 IN NS l.gtld-servers.net. com. 172800 IN NS c.gtld-servers.net. com. 172800 IN NS m.gtld-servers.net. com. 172800 IN NS h.gtld-servers.net. com. 172800 IN NS a.gtld-servers.net. com. 172800 IN NS d.gtld-servers.net. com. 172800 IN NS j.gtld-servers.net. com. 172800 IN NS g.gtld-servers.net. com. 172800 IN NS b.gtld-servers.net. com. 172800 IN NS i.gtld-servers.net. com. 86400 IN DS 30909 8 2 E2D3C916F6DEEAC73294E8268FB5885044A833FC5459588F4A9184CF C41A5766 com. 86400 IN RRSIG DS 8 1 86400 20170114170000 20170101160000 61045 . KgQhCm8rknGjV9iAai7HdwFss+8fKCMKHtXjfh84b2CWhaHzdHZWbUDf jBpCHTOyukWzHfkPDf6Nl525YK8wLGKYrij+1F6dkB/VXHnqLvArmAjN /qS5sHc4OqeAD9Q1I+1nQQ27Ap1CWETdXjGk1XsU4qeQrzsXoK1pdQ7p HAbpnNfL8B95IlzusGnfvlMDE5EfDtvx2ai2GRqyqnwBlJslPJi/USby nDA9d/z8/FI0ed5tI9uCAqtPidvqlz9uV5obH/KDI3L54tdZhPx8bt21 eb8o6MJp6fFRJ5SMnxOL+jG8wd2pyeMHrrKewDljeH0+aOvhZq4R0d0k cWX04g== ;; Received 865 bytes from 199.7.91.13#53(d.root-servers.net) in 624 ms baidu.com. 172800 IN NS dns.baidu.com. baidu.com. 172800 IN NS ns2.baidu.com. baidu.com. 172800 IN NS ns3.baidu.com. baidu.com. 172800 IN NS ns4.baidu.com. baidu.com. 172800 IN NS ns7.baidu.com. CK0POJMG874LJREF7EFN8430QVIT8BSM.com. 86400 IN NSEC3 1 1 0 - CK0Q1GIN43N1ARRC9OSM6QPQR81H5M9A NS SOA RRSIG DNSKEY NSEC3PARAM CK0POJMG874LJREF7EFN8430QVIT8BSM.com. 86400 IN RRSIG NSEC3 8 2 86400 20170105054741 20161229043741 6404 com. TSHb55e0r15Btrmk/JB9gDZfI+vuIbnWGVTodQML31eb2l2mQpxEhH8U kX8SrPwYIGxCoidyuh7wCUgaRWq1Xpj6YMHMm39t89DDbg4qE8qLl1YV n2f64yBoYDP2K74LlD67WQQMmm19fyjHWrdmtjOly9kKR0UDHuKhZmLk KuM= HPVV2B5N85O7HJJRB7690IB5UVF9O9UA.com. 86400 IN NSEC3 1 1 0 - HQ01H2D8Q0MT897NAE62MCFNM16HPMG6 NS DS RRSIG HPVV2B5N85O7HJJRB7690IB5UVF9O9UA.com. 86400 IN RRSIG NSEC3 8 2 86400 20170107055340 20161231044340 6404 com. IVepsIZfF+1fiyN3X+cndlryDcFWXIXh8zlW66ZMJj1HueMed7kTPh32 yDgDREMPxv+W0B5JHPy7x3ULz09tts3DEx4uw9rrHdBAHpPKUhrisQRH bvifjg6dnKB1cWJc7nJNJUEZUWYWqNQvgC06nrowY+bYZ0KxBGlmGbPg +0I= ;; Received 697 bytes from 192.31.80.30#53(d.gtld-servers.net) in 101 ms www.baidu.com. 1200 IN CNAME www.a.shifen.com. a.shifen.com. 1200 IN NS ns4.a.shifen.com. a.shifen.com. 1200 IN NS ns1.a.shifen.com. a.shifen.com. 1200 IN NS ns3.a.shifen.com. a.shifen.com. 1200 IN NS ns5.a.shifen.com. a.shifen.com. 1200 IN NS ns2.a.shifen.com. ;; Received 239 bytes from 220.181.38.10#53(ns4.baidu.com) in 4 ms [root@web01 ~]#
本文出自 “砖家博客” 博客,请务必保留此出处http://wsxxsl.blog.51cto.com/9085838/1888231
工作中常用的几个命令
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。