Networking

ping

Used to test the reachability of a host on an Internet Protocol (IP) network. Ping works by sending one or more ICMP (Internet Control Message Protocol) Echo Request packets to a specified destination IP on the network and waits for a reply. When the destination receives the packets, it responds with an ICMP echo reply. docs

# Usage
ping hostname
# OS and packages
apt install iputils-ping  # debian/ubuntu
yum install iputils  # centos/fedora(dnf, microdnf, rpm, yum)
pacman -S iputils  # arch(pacman)
apk add iputils-ping # alpine
brew install iputils  # OS X

ip

Tool for configuring network interfaces. docs

# Usage
ip neigh # neighbour table in kernel
ip route # display the routing table
# OS and packages
apt install iproute2  # debian/ubuntu
yum install net-tools  # centos/fedora(dnf, microdnf, rpm, yum)
pacman -S iproute2  # arch(pacman)
apk add iproute2 # alpine

nc & telnet

Used to check the open ports. nc docs and telnet docs

# Usage
nc -lv 1234 # start a listener on port 1234
nc -zv google.com 443 # check if port is open
nc -zv 10.0.2.4 1230-1235 # scanning a port range
telnet host.com 1234 # connect to the port in the HOST
# OS and packages
apt install telnet netcat  # debian/ubuntu
yum install telnet netcat  # centos/fedora(dnf, microdnf, rpm, yum)
pacman -S inetutils gnu-netcat  # arch(pacman)
apk add netcat-openbsd inetutils-telnet  # alpine

netstat

Print network connections and interface statistics. docs

# Usage
netstat -a # list all open TCP & UDP ports
netstat -at # ONLY tcp ports
netstat -au # ONLY udp ports
netatat -ap # open ports along with the PID/program names
netstat -an | grep LISTEN
# OS and packages
apt install net-tools  # debian/ubuntu
yum install net-tools  # centos/fedora(dnf, microdnf, rpm, yum)
pacman -S netstat # arch(pacman)
apk add net-tools # alpine