User Tools

Site Tools


Shell commands focused on network

Install network tools


apt install -y iputils-ping # for ping
apt install -y dnsutils # for dig, etc.
apt install -y net-tools # for netstat, etc.
apt install -y nmap


yum install -y bind-utils # for nslookup, etc.
yum install -y nmap # for ncat, etc.

Basic commands


Lookup DNS for an url

dig <any_url>

Show the IPs connected to a machine

netstat -ntpul

Show listening ports & processes on a machine

lsof -i -P -n
lsof -i -P -n | grep LISTEN

Netcat : check if 2 machines are able to communicate on a specified port

nc -l -p 1337 # the receiver
nc localhost 1337 # the sender
# then type something, then enter, it should be transfered to the receiver

Ping an IP on a particular port

Telnet method

telnet 4648

Nmap method (/!\ may bypass restrictions)

nmap -Pn -p 4648

Find the IPs connected on the same LAN

Nmap method

nmap -sP <current_ip>/24

ARP method

sudo arp-scan --interface=<current_interface> --localnet


tcpdump -i any host
tcpdump -i any port 443
tcpdump -i any port 443 and host or host or host
tcpdump -ni any port 443 and host or host or host


iptables -L -t nat

# pour faire un clean
iptables -F -t nat
shell-network.txt · Last modified: 2020/05/05 12:21 by jdx