linux網(wǎng)絡(luò)操作相關(guān)命令匯總
更新時間:2013年06月03日 15:52:00 作者:
linux網(wǎng)絡(luò)操作需要熟悉很多的相關(guān)命令,下面為大家整理了一些常用的網(wǎng)絡(luò)操作命令,感興趣的朋友可以參考下哈
linux操作相關(guān)命令匯總的github地址:https://github.com/zhwj184/shell-work
#/bin/sh
#查看http請求的header
tcpdump -s 1024 -l -A -n host 192.168.9.56
tcpdump -s 1024 -l -A src 192.168.9.56 or dst 192.168.9.56
sudo tcpdump -A -s 1492 dst port 80
#本地網(wǎng)絡(luò)中IP地址為192.168.0.5的主機(jī)現(xiàn)在與外界通信的情況
sudo tcpdump -i eth0 src host 192.168.0.5
#查看網(wǎng)卡eth0的http請求的tcp包
tcpdump -i eth0 port http
tcpdump -i eth0 port http or port smtp or port imap or port pop3 -l -A | egrep -i 'pass=|pwd=|log=|login=|user=|username=|pw=|passw=|passwd=|password=|pass:|user:|userna me:|password:|login:|pass |user '
#查看tcp,upd,icmp非ssh的包
tcpdump -n -v tcp or udp or icmp and not port 22
#查看http請求的request 包
sudo tcpdump -i eth0 port 80 -w -
#過濾http響應(yīng)的get host頭信息
sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "GET \/.*|Host\: .*"
#DNS查詢請求響應(yīng)包
sudo tcpdump -i en0 'udp port 53'
#nmap -sP指定使用Ping echo 進(jìn)行掃描 /24查看目的網(wǎng)絡(luò)有多少主機(jī)處于運(yùn)行狀態(tài)
nmap -sP 192.168.0.1
nmap -sP 192.168.0.0/24
nmap -O www.baidu.com
#Netstat主要用于Linux/Unix主機(jī)察看自身的網(wǎng)絡(luò)狀況,如開啟的端口、在為哪些用戶服務(wù)以及服務(wù)的狀態(tài)
netstat -a
netstat -nlp
#netcat掃描機(jī)器開放的端口
nc -z -v -n 172.31.100.7 21-25
#netcat 命令會連接開放端口21并且打印運(yùn)行在這個端口上服務(wù)的banner信息。
nc -v 172.31.100.7 21
#輸出網(wǎng)絡(luò)的路由表
route
#顯示結(jié)果包括服務(wù)器已經(jīng)運(yùn)行了多長時間,有多少登陸用戶和對服務(wù)器性能的總體評估(load average)。
uptime
#監(jiān)控 eth1 的網(wǎng)卡的流量
iftop -i eth1
#以位元組(bytes 即字節(jié))為單位顯示流量(預(yù)設(shè)是位元 bits):
iftop -B
#直接顯示 IP, 不進(jìn)行DNS 反解:
iftop -n
#直接顯示連接埠編號, 不顯示服務(wù)名稱:
iftop -N
#顯示某個網(wǎng)段進(jìn)出封包流量
iftop -F 192.168.1.0/24 or 192.168.1.0/255.255.255.0
#網(wǎng)絡(luò)流量實時監(jiān)控工具之nload,查看網(wǎng)卡eth0的流量
nload -n eth0
#查看各個網(wǎng)卡的流量
nload -h
#IPTraf是一個網(wǎng)絡(luò)監(jiān)控工具,功能比nload更強(qiáng)大,可以監(jiān)控所有的流量,IP流量,按協(xié)議分的流量,還可以設(shè)置過濾器
iptraf
#查看網(wǎng)絡(luò)接口當(dāng)前配置與接口命名:
ifconfig
#打開(up)或關(guān)閉(down)適配器
ifconfig <網(wǎng)絡(luò)名> <up|down>
#為適配器分配IP地址:
ifconfig <網(wǎng)絡(luò)名> <ip地址>
#為適配器分配第二個IP地址:
ifconfig <網(wǎng)絡(luò)名:實例數(shù)> <ip地址>
#顯示某個網(wǎng)絡(luò)適配器的驅(qū)動信息,適用于查詢軟件兼容性的情況:
ethtool -i eth0
#顯示網(wǎng)絡(luò)數(shù)據(jù):
ethtool -S
#設(shè)置適配器連接速度(Mbps)
ethtool speed <10|100|1000>
#iwconfig 查基本的Wi-Fi網(wǎng)絡(luò)設(shè)置,如SSID、channel和加密等細(xì)節(jié)。此外還可以修改一些高級設(shè)置,包括接收敏感度,RTS/CTS,碎片,以及重試數(shù)
#顯示當(dāng)前無線設(shè)置,包括接口名稱:
iwconfig
#設(shè)置ESSID(擴(kuò)展服務(wù)設(shè)置識別器)或網(wǎng)絡(luò)名:
iwconfig <接口名> essid <網(wǎng)絡(luò)名>
#wget
wget -S --spider http://osswin.sourceforge.net/ 2>&1 | grep Mod
#查看mac地址
cat /sys/class/net/*/address
#查看eth0的ip
ifconfig eth0 | awk '/inet addr/ {split ($2,A,":"); print A[2]}'
#curl 查看頁面對應(yīng)的domail name
curl -s http://en.m.wikipedia.org/wiki/List_of_Internet_top-level_domains | sed -n '/<tr valign="top">/{s/<[^>]*>//g;p}'
#talnet
telnet localhost 6666
#查看所有的網(wǎng)絡(luò)接口
awk '{print $1}' /proc/net/dev|grep :|sed "s/:.*//g"
#查看DNS server版本好
nslookup -q=txt -class=CHAOS version.bind NS.PHX5.NEARLYFREESPEECH.NET
復(fù)制代碼 代碼如下:
#/bin/sh
#查看http請求的header
tcpdump -s 1024 -l -A -n host 192.168.9.56
tcpdump -s 1024 -l -A src 192.168.9.56 or dst 192.168.9.56
sudo tcpdump -A -s 1492 dst port 80
#本地網(wǎng)絡(luò)中IP地址為192.168.0.5的主機(jī)現(xiàn)在與外界通信的情況
sudo tcpdump -i eth0 src host 192.168.0.5
#查看網(wǎng)卡eth0的http請求的tcp包
tcpdump -i eth0 port http
tcpdump -i eth0 port http or port smtp or port imap or port pop3 -l -A | egrep -i 'pass=|pwd=|log=|login=|user=|username=|pw=|passw=|passwd=|password=|pass:|user:|userna me:|password:|login:|pass |user '
#查看tcp,upd,icmp非ssh的包
tcpdump -n -v tcp or udp or icmp and not port 22
#查看http請求的request 包
sudo tcpdump -i eth0 port 80 -w -
#過濾http響應(yīng)的get host頭信息
sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "GET \/.*|Host\: .*"
#DNS查詢請求響應(yīng)包
sudo tcpdump -i en0 'udp port 53'
#nmap -sP指定使用Ping echo 進(jìn)行掃描 /24查看目的網(wǎng)絡(luò)有多少主機(jī)處于運(yùn)行狀態(tài)
nmap -sP 192.168.0.1
nmap -sP 192.168.0.0/24
nmap -O www.baidu.com
#Netstat主要用于Linux/Unix主機(jī)察看自身的網(wǎng)絡(luò)狀況,如開啟的端口、在為哪些用戶服務(wù)以及服務(wù)的狀態(tài)
netstat -a
netstat -nlp
#netcat掃描機(jī)器開放的端口
nc -z -v -n 172.31.100.7 21-25
#netcat 命令會連接開放端口21并且打印運(yùn)行在這個端口上服務(wù)的banner信息。
nc -v 172.31.100.7 21
#輸出網(wǎng)絡(luò)的路由表
route
#顯示結(jié)果包括服務(wù)器已經(jīng)運(yùn)行了多長時間,有多少登陸用戶和對服務(wù)器性能的總體評估(load average)。
uptime
#監(jiān)控 eth1 的網(wǎng)卡的流量
iftop -i eth1
#以位元組(bytes 即字節(jié))為單位顯示流量(預(yù)設(shè)是位元 bits):
iftop -B
#直接顯示 IP, 不進(jìn)行DNS 反解:
iftop -n
#直接顯示連接埠編號, 不顯示服務(wù)名稱:
iftop -N
#顯示某個網(wǎng)段進(jìn)出封包流量
iftop -F 192.168.1.0/24 or 192.168.1.0/255.255.255.0
#網(wǎng)絡(luò)流量實時監(jiān)控工具之nload,查看網(wǎng)卡eth0的流量
nload -n eth0
#查看各個網(wǎng)卡的流量
nload -h
#IPTraf是一個網(wǎng)絡(luò)監(jiān)控工具,功能比nload更強(qiáng)大,可以監(jiān)控所有的流量,IP流量,按協(xié)議分的流量,還可以設(shè)置過濾器
iptraf
#查看網(wǎng)絡(luò)接口當(dāng)前配置與接口命名:
ifconfig
#打開(up)或關(guān)閉(down)適配器
ifconfig <網(wǎng)絡(luò)名> <up|down>
#為適配器分配IP地址:
ifconfig <網(wǎng)絡(luò)名> <ip地址>
#為適配器分配第二個IP地址:
ifconfig <網(wǎng)絡(luò)名:實例數(shù)> <ip地址>
#顯示某個網(wǎng)絡(luò)適配器的驅(qū)動信息,適用于查詢軟件兼容性的情況:
ethtool -i eth0
#顯示網(wǎng)絡(luò)數(shù)據(jù):
ethtool -S
#設(shè)置適配器連接速度(Mbps)
ethtool speed <10|100|1000>
#iwconfig 查基本的Wi-Fi網(wǎng)絡(luò)設(shè)置,如SSID、channel和加密等細(xì)節(jié)。此外還可以修改一些高級設(shè)置,包括接收敏感度,RTS/CTS,碎片,以及重試數(shù)
#顯示當(dāng)前無線設(shè)置,包括接口名稱:
iwconfig
#設(shè)置ESSID(擴(kuò)展服務(wù)設(shè)置識別器)或網(wǎng)絡(luò)名:
iwconfig <接口名> essid <網(wǎng)絡(luò)名>
#wget
wget -S --spider http://osswin.sourceforge.net/ 2>&1 | grep Mod
#查看mac地址
cat /sys/class/net/*/address
#查看eth0的ip
ifconfig eth0 | awk '/inet addr/ {split ($2,A,":"); print A[2]}'
#curl 查看頁面對應(yīng)的domail name
curl -s http://en.m.wikipedia.org/wiki/List_of_Internet_top-level_domains | sed -n '/<tr valign="top">/{s/<[^>]*>//g;p}'
#talnet
telnet localhost 6666
#查看所有的網(wǎng)絡(luò)接口
awk '{print $1}' /proc/net/dev|grep :|sed "s/:.*//g"
#查看DNS server版本好
nslookup -q=txt -class=CHAOS version.bind NS.PHX5.NEARLYFREESPEECH.NET
您可能感興趣的文章:
- linux 雙網(wǎng)卡綁定網(wǎng)絡(luò)設(shè)置方法
- Linux下用netstat查看網(wǎng)絡(luò)狀態(tài)、端口狀態(tài)
- 檢查linux網(wǎng)絡(luò)狀態(tài)的兩個腳本
- Linux基本網(wǎng)絡(luò)配置方法介紹
- Linux網(wǎng)絡(luò)服務(wù)器配置基礎(chǔ)
- 解讀Linux下ip命令展示的網(wǎng)絡(luò)連接信息
- linux網(wǎng)絡(luò)NAT配置方式詳解
- Linux網(wǎng)絡(luò)相關(guān)配置文件
- 在Linux中如何查看可用的網(wǎng)絡(luò)接口詳解
- 電腦意外關(guān)機(jī)后VMware中l(wèi)inux不能聯(lián)網(wǎng)問題的解決方法
相關(guān)文章
每個系統(tǒng)管理員必知的 30 個 Linux 系統(tǒng)監(jiān)控工具
本文提到的是一些基本的命令,用于系統(tǒng)分析和服務(wù)器調(diào)試等,接下來通過本文給大家分享每個系統(tǒng)管理員必知的 30 個 Linux 系統(tǒng)監(jiān)控工具,感興趣的朋友跟隨腳本之家小編一起看看吧2018-03-03Linux系統(tǒng)中查找正在運(yùn)行的nginx目錄
這篇文章主要介紹了Linux系統(tǒng)中查找正在運(yùn)行的nginx目錄,本文內(nèi)容簡單但是給大家介紹的非常詳細(xì) ,需要的朋友可以參考下2019-05-05Linux C中庫函數(shù)與系統(tǒng)調(diào)用的區(qū)別詳細(xì)解析
以下是對Linux下C中庫函數(shù)和系統(tǒng)調(diào)用的區(qū)別進(jìn)行了詳細(xì)的分析介紹,需要的朋友可以過來參考下2013-08-08