Linux Networking Commands

Master network information gathering, port scanning with nmap, secure file transfer, SSH remote access, and bash scripting fundamentals for practical penetration testing.

Network Information Commands

Gather network configuration and connectivity information from your system.

ip a

Display all network interfaces and IP addresses

USAGE:

ip a

EXAMPLE:

$ ip a
1: lo: <LOOPBACK,UP,...>
    inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,...>
    inet 192.168.1.100/24 brd 192.168.1.255
ifconfig

Show network interface configuration

USAGE:

ifconfig

EXAMPLE:

$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>
  inet 192.168.1.100  netmask 255.255.255.0
  ether 08:00:27:ba:43:12  txqueuelen 1000
hostname

Display or set system hostname

USAGE:

hostname

EXAMPLE:

$ hostname
kali-linux
$ hostname -I
192.168.1.100
ping

Test connectivity to target host

USAGE:

ping -c 4 8.8.8.8

EXAMPLE:

$ ping -c 4 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=119 time=23.4 ms
traceroute

Show route packets take to reach target

USAGE:

traceroute 8.8.8.8

EXAMPLE:

$ traceroute 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max
1  192.168.1.1 (gateway)  1.234 ms
2  isp.router (10.x.x.x)  5.123 ms