码迷,mamicode.com
首页 > 系统相关 > 详细

linux命令之grep、cut

时间:2017-11-11 11:28:29      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:linux   inet6   4.0   linu   logs   scope   efi   bytes   mac地址   

输入:

ifconfig eth0

eth0表示主机的第一块网卡。

输出:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.118.136  netmask 255.255.255.0  broadcast 192.168.118.255
        inet6 fe80::20c:29ff:fe2c:3c8f  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:2c:3c:8f  txqueuelen 1000  (Ethernet)
        RX packets 153785  bytes 172057146 (164.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 67213  bytes 9694191 (9.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

RX为接收的包,TX 为发出的包。ether 00:0c:29:2c:3c:8f 为MAC地址。

 

输入:

ifconfig eth0 | grep inet 

输出:

inet 192.168.118.136  netmask 255.255.255.0  broadcast 192.168.118.255

显示所有包含‘inet ’的行。

 

cut命令:

语法格式:cut  [-bn] [file] 或 cut [-c] [file]  或  cut [-df] [file]

-b代表提取字节,-c代表提取字符(中文字符包含两个字节),-d为自定义分割符,默认为制表符。-f与-d一起使用,指定显示哪个区域。

 

linux命令之grep、cut

标签:linux   inet6   4.0   linu   logs   scope   efi   bytes   mac地址   

原文地址:http://www.cnblogs.com/benbencoding798/p/7818262.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!