Linux-related command summary github address: https://github.com/zhwj184/shell-work
Copy codeThe Code is as follows: #/bin/sh
# Viewing http request headers
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
# The host with the IP address 192.168.0.5 in the local network now communicates with the outside world
Sudo tcpdump-I eth0 src host 192.168.0.5
# View the tcp packet of the http request of the network adapter eth0
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'
# View tcp, upd, and icmp non-ssh packets
Tcpdump-n-v tcp or udp or icmp and not port 22
# View the http request package
Sudo tcpdump-I eth0 port 80-w-
# Filter the http Response's get host header information
Sudo tcpdump-I en1-n-s 0-w-| grep-a-o-E "GET \/. * | Host \:.*"
# DNS query request response package
Sudo tcpdump-I en0 'udp port 53'
# Nmap-sP specify to use Ping echo for scanning/24 to view how many hosts in the target network are running
Nmap-sP 192.168.0.1
Nmap-sP 192.168.0.0/24
Nmap-O www.baidu.com
# Netstat is mainly used for Linux/Unix hosts to view their network conditions, such as the opened ports, the user services and service statuses.
Netstat-
Netstat-nlp
# Netcat scan ports opened by machines
Nc-z-v-n 172.31.100.7 21-25
# The netcat command will connect to open port 21 and print the banner information of the Service running on this port.
Nc-v 172.31.100.7 21
# Route table of the output Network
Route
# The result shows how long the server has been running, how many login users are there, and the overall server performance evaluation (load average ).
Uptime
# Monitor the network card Traffic of eth1
Iftop-I eth1
# Display traffic in bytes (bytes) (default: bits ):
Iftop-B
# Directly display the IP address without reverse DNS resolution:
Iftop-n
# The Connection port number is displayed directly, but the service name is not displayed:
Iftop-N
# Display inbound and outbound traffic of a CIDR Block
Iftop-F 192.168.1.0/24 or 192.168.1.0/255.255.255.0
# Nload, a real-time network traffic monitoring tool, to view the eth0 traffic of the Network Adapter
Nload-n eth0
# View the traffic of each Nic
Nload-h
# IPTraf is a network monitoring tool with more powerful functions than nload. It can monitor all traffic, IP traffic, protocol-based traffic, and set filters.
Iptraf
# View the current configuration of the network interface and the interface Name:
Ifconfig
# Enable or disable the (down) Adapter
Ifconfig <Network Name> <up | down>
# Assign an IP address to the adapter:
Ifconfig <Network Name> <IP address>
# Assign a second IP address to the adapter:
Ifconfig <Network Name: number of instances> <IP address>
# Display the driver information of a network adapter, which is suitable for querying software compatibility:
Ethtool-I eth0
# Display network data:
Ethtool-S
# Set the adapter connection speed (Mbps)
Ethtool speed <10 | 100 | 1000>
# Iwconfig check basic Wi-Fi network settings, such as SSID, channel, and encryption. You can also modify some advanced settings, including the receipt sensitivity, RTS/CTS, fragments, and number of retries.
# Display the current wireless settings, including the Interface Name:
Iwconfig
# Set ESSID (extended service setting reader) or network name:
Iwconfig <Interface Name> essid <Network Name>
# Wget
Wget-S -- spider http://osswin.sourceforge.net/2> & 1 | grep Mod
# View mac addresses
Cat/sys/class/net/*/address
# View the ip address of eth0
Ifconfig eth0 | awk '/inet addr/{split ($2, A, ":"); print A [2]}'
# Curl: view the domail name corresponding to the page
Curl-s http://en.m.wikipedia.org/wiki/List_of_Internet_top-level_domains | sed-n'/<tr valign = "top">/{s/<[^>] *> // g; p }'
# Talnet
Telnet local host 6666
# View all network interfaces
Awk '{print $1}'/proc/net/dev | grep: | sed "s/:. * // g"
# Check the DNS server version
Nslookup-q = txt-class = CHAOS version. bind NS. PHX5.NEARLYFREESPEECH. NET