Course Content
Ethical Hacking – Starts Here
0/70
Ethical Hacking from Entry to Expertise

Here’s a list of some useful Linux network commands along with brief explanations:

  1. ifconfig

Description: Displays or configures network interface parameters such as IP addresses, netmasks, and interfaces. (Deprecated in favor of ip command in newer distributions)

root@insectechs:~#ifconfig   # Display network interface configuration

  1. ip

Description: A more modern and flexible command to configure networking (replaces ifconfig). It shows network interface information, adds routes, etc.

root@insectechs:~#ip addr show    # Display IP address information

root@insectechs:~#ip link show    # Display link-layer information (network interfaces)

  1. ping

Description: Sends ICMP Echo Request packets to a network host to check if the host is reachable.

root@insectechs:~#ping insectechs.in  # Pings Google’s server

  1. netstat

Description: Displays network connections, routing tables, and network interface statistics. (Note: replaced by ss in some systems)

 

root@insectechs:~#netstat -tuln    # Show all listening ports and associated IP addresses

  1. ss

Description: A more powerful and faster tool than netstat to display socket statistics and network connections.

root@insectechs:~#ss -tuln        # Show listening ports with socket information

  1. traceroute

Description: Traces the path packets take to reach a remote host, showing each hop along the way.

root@insectechs:~#traceroute insectechs.in  # Trace the route to Google’s servers

  1. dig

Description: A DNS lookup tool to query domain name servers for information about domains, such as IP addresses.

root@insectechs:~#dig insectechs.in  # Get DNS information for google.com

  1. nslookup

Description: Queries the Domain Name System (DNS) to find IP addresses associated with domain names.

root@insectechs:~#nslookup insectechs.in  # Get IP address information for google.com

  1. curl

Description: A tool for transferring data to or from a server using various protocols (HTTP, FTP, etc.). Commonly used to download files or interact with APIs.

root@insectechs:~#curl http://insectechs.in  # Fetch a webpage

root@insectechs:~#curl -O http://insectechs.in/file.zip  # Download a file

  1. wget

Description: A command-line utility to download files from the web using HTTP, HTTPS, and FTP protocols.

root@insectechs:~#wget http://insectechs.in/file.zip  # Download a file from the web

  1. route

Description: Displays or modifies the routing table in Linux, used to determine how packets are forwarded across networks.

root@insectechs:~#route -n  # Display the routing table

  1. hostname

Description: Shows or sets the system’s hostname (the name of the computer on the network).

root@insectechs:~#hostname   # Display the system’s hostname

root@insectechs:~#hostname newname  # Change the system’s hostname

  1. ip route

Description: Displays or manipulates the IP routing table (used to control the network routing of data packets).

root@insectechs:~#ip route show  # Show the current routing table

  1. arp

Description: Displays or manipulates the system’s ARP (Address Resolution Protocol) cache, which stores the mapping between IP addresses and MAC addresses.

root@insectechs:~#arp -a  # Display the ARP table

  1. tcpdump

Description: A packet analyzer tool used to capture and inspect network traffic.

root@insectechs:~#tcpdump -i eth0  # Capture packets on the eth0 interface

  1. netcat (nc)

Description: A powerful networking tool used for reading and writing data across network connections, useful for debugging and setting up network services.

root@insectechs:#nc -l 1234  # Start a listener on port 1234

root@insectechs:~#nc google.com 80  # Connect to Google on port 80

  1. mtr

Description: A network diagnostic tool that combines the functionality of traceroute and ping to give real-time information about network latency and packet loss.

root@insectechs:~#mtr insectechs.in  # Trace the route to Google with real-time statistics

  1. ip link

Description: Displays or manages the state of network interfaces (up/down).

root@insectechs:~#ip link set eth0 up   # Bring the eth0 interface up

root@insectechs:~#ip link set eth0 down # Bring the eth0 interface down

  1. ip addr

Description: Displays and configures IP addresses on network interfaces.

root@insectechs:~#ip addr show eth0  # Show IP address information for eth0

  1. iwconfig

Description: Displays or configures wireless network interfaces.

root@insectechs:~#iwconfig wlan0  # Show wireless settings for wlan0

  1. ss -tuln

Description: Displays listening ports and associated network connections. It’s faster and more reliable than netstat.

root@insectechs:~#ss -tuln  # Show listening TCP/UDP sockets

  1. ufw

Description: A frontend for managing firewall rules in Linux. It’s an easy-to-use tool to configure firewall settings.

root@insectechs:~#ufw allow 80/tcp   # Allow incoming connections on port 80 (HTTP)

root@insectechs:~#ufw enable         # Enable the firewall

These network commands are essential for managing and troubleshooting network configurations, diagnosing connectivity issues, and understanding network traffic on a Linux system.

0% Complete
Select your currency
USD United States (US) dollar