10 个面试必问的 Linux 网络和监控命令

网络和监控命令类似于这些:hostname, ping, ifconfig, iwconfig, netstat, nslookup, traceroute, finger, telnet, ethtool
hostname
hostname 没有选项,显示主机名字

hostname –d 显示机器所属域名

hostname –f 显示完整的主机名和域名

hostname –i 显示当前机器的ip地址

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
ping
ping 将数据包发向用户指定地址。当包被接收,目标机器发送返回数据包。ping 主要有两个作用:
用来确认网络连接是畅通的。
用来查看连接的速度信息。

如果你 ping www.yahoo.com 它将返回它的ip地址 。你可以通过 ctrl+C 来停止命令。

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
ifconfig
查看用户网络配置。它显示当前网络设备配置。对于需要接收或者发送数据错误查找,这个工具极为好用。

 
 
 
 
  • 1
iwconfig
iwconfig 工具与 ifconfig 和ethtool类似。是用于无线网卡的 . 
你可以用他查看设置基本的Wi-Fi 网络信息,
例如 SSID, channel和encryption.还有其他很多配置你也可以查看和修改,
包括 接收灵敏度, RTS/CTS, 发送数据包的分片大小,以及无线网卡的重传机制。

 
 
 
 
  • 1
  • 2
  • 3
  • 4
nslookup
nslookup 这个命令在 有ip地址时,可以用这个命令来显示主机名,可以找到给定域名的所有ip地址。而你必须连接到互联网才能使用这个命令。

例子. nslookup blogger.com

你也可以使用 nslookup 从ip获得主机名或从主机名获得ip。

  • 1
  • 2
  • 3
  • 4
  • 5
traceroute
一个方便的工具,可用来查看数据包在提交到远程系统或者网站时候所经过的路由器的IP地址、跳数和响应时间。
同样你必须链接到互联网才能使用这个命令。

 
 
 
 
  • 1
  • 2
finger
查看用户信息。显示用户的登录名字、真实名字以及登录终端的名字和登录权限。
这是unix一个很老的命令,现在已很少使用了。

 
 
 
 
  • 1
  • 2
telnet
通过telnet协议连接目标主机,如果telnet连接可以在任一端口上完成即代表着两台主机间的连接良好。

telnet hostname port – 使用指定的端口telnet主机名。这通常用来测试主机是否在线或者网络是否正常。

  • 1
  • 2
  • 3
ethtool
ethtool允许你查看和更改网卡的许多设置(不包括Wi-Fi网卡)。你可以管理许多高级设置,包括tx/rx、校验及网络唤醒功能。下面是一些你可能感兴趣的基本命令:

ethtool -i 显示一个特定网卡的驱动信息,检查软件兼容性时尤其有用

ethtool -p 启动一个适配器的指定行为,比如让适配器的LED灯闪烁,以帮助你在多个适配器或接口中标识接口名称

ethtool -s 显示网络统计信息

ethtool speed <10|100|1000> 设置适配器的连接速度,单位是Mbps

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
netstat
发现主机连接最有用最通用的Linux命令。你可以使用”netstat -g”查询该主机订阅的所有多播组(网络)

netstat -nap | grep port 将会显示使用该端口的应用程序的进程id

netstat -a or netstat –all 将会显示包括TCP和UDP的所有连接

netstat –tcp or netstat –t 将会显示TCP连接

netstat –udp or netstat –u 将会显示UDP连接

netstat -g 将会显示该主机订阅的所有多播网络。

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
                                </div>
            <link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-b6c3c6d139.css" rel="stylesheet">
                                            <div class="more-toolbox">
            <div class="left-toolbox">
                <ul class="toolbox-list">
                    
                    <li class="tool-item tool-active is-like "><a href="javascript:;"><svg class="icon" aria-hidden="true">
                        <use xlink:href="#csdnc-thumbsup"></use>
                    </svg><span class="name">点赞</span>
                    <span class="count"></span>
                    </a></li>
                    <li class="tool-item tool-active is-collection "><a href="javascript:;" data-report-click="{&quot;mod&quot;:&quot;popu_824&quot;}"><svg class="icon" aria-hidden="true">
                        <use xlink:href="#icon-csdnc-Collection-G"></use>
                    </svg><span class="name">收藏</span></a></li>
                    <li class="tool-item tool-active is-share"><a href="javascript:;" data-report-click="{&quot;mod&quot;:&quot;1582594662_002&quot;}"><svg class="icon" aria-hidden="true">
                        <use xlink:href="#icon-csdnc-fenxiang"></use>
                    </svg>分享</a></li>
                    <!--打赏开始-->
                                            <!--打赏结束-->
                                            <li class="tool-item tool-more">
                        <a>
                        <svg t="1575545411852" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5717" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M179.176 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5718"></path><path d="M509.684 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5719"></path><path d="M846.175 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5720"></path></svg>
                        </a>
                        <ul class="more-box">
                            <li class="item"><a class="article-report">文章举报</a></li>
                        </ul>
                    </li>
                                        </ul>
            </div>
                        </div>
        <div class="person-messagebox">
            <div class="left-message"><a href="https://blog.csdn.net/xie_qi_chao">
                <img src="https://profile.csdnimg.cn/B/F/6/3_xie_qi_chao" class="avatar_pic" username="xie_qi_chao">
                                        <img src="https://g.csdnimg.cn/static/user-reg-year/1x/2.png" class="user-years">
                                </a></div>
            <div class="middle-message">
                                    <div class="title"><span class="tit"><a href="https://blog.csdn.net/xie_qi_chao" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;}" target="_blank">解启超</a></span>
                                        </div>
                <div class="text"><span>发布了329 篇原创文章</span> · <span>获赞 52</span> · <span>访问量 3万+</span></div>
            </div>
                            <div class="right-message">
                                        <a href="https://im.csdn.net/im/main.html?userName=xie_qi_chao" target="_blank" class="btn btn-sm btn-red-hollow bt-button personal-letter">私信
                    </a>
                                                        <a class="btn btn-sm  bt-button personal-watch" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;}">关注</a>
                                </div>
                        </div>
                </div>
</article>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

尹汇川

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值