国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > Linux Shell > 正文

Shell腳本獲取本地網卡IP、mac地址、子網掩碼、dns IP、外網IP

2020-07-27 19:12:47
字體:
來源:轉載
供稿:網友

#/usr/bin/env bash# Name: get_network_info.sh# Author: Purple_Grape# This is a script to gather network information of your Linux system.# Test under Ubuntu 10.04 only.#----------------------------NIC=eth0MAC=`LANG=C ifconfig $NIC | awk '/HWaddr/{ print $5 }' `IP=`LANG=C ifconfig $NIC | awk '/inet addr:/{ print $2 }' | awk -F: '{print $2 }'`MASK=`LANG=C ifconfig $NIC | awk -F: '/Mask/{print $4}'`ext_ip=`curl ifconfig.me`if [ -f /etc/resolv.conf ];then   dns=`awk '/^nameserver/{print $2}' /etc/resolv.conf `fi#----------------------------echo "Your network information is as below:"echo $MACecho $IPecho $dnsecho $ext_ip

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 都匀市| 四会市| 深圳市| 阆中市| 慈利县| 沁源县| 韶山市| 微山县| 饶河县| 大丰市| 清苑县| 淮阳县| 徐闻县| 泊头市| 仲巴县| 安岳县| 建昌县| 白河县| 胶州市| 长治市| 铜陵市| 南城县| 大港区| 德庆县| 宿迁市| 卫辉市| 宝兴县| 上栗县| 增城市| 昌邑市| 介休市| 韶关市| 友谊县| 黄浦区| 遵义县| 南安市| 东乡族自治县| 哈巴河县| 屏边| 夏河县| 红安县|