DEV Community

Pranav Bakare
Pranav Bakare

Posted on

Top 10 networking commands

Here are the top 10 networking commands in Linux, along with sample examples:

  1. ifconfig

Used to configure or display the network interfaces.

Example:

ifconfig

This will display details like IP address, netmask, and broadcast for each network interface.

  1. ip

The newer alternative to ifconfig used to display or manipulate routing, devices, policy routing, and tunnels.

Example:

ip addr show

This command shows the IP addresses of all the network interfaces.

  1. ping

Used to check the connectivity between the host and the destination.

Example:

ping google.com

This will continuously ping Google's server to check if it's reachable.

  1. netstat

Displays network connections, routing tables, interface statistics, and more.

Example:

netstat -tuln

This command shows all the listening (open) ports on the system, along with their corresponding services.

  1. traceroute

Shows the path that a packet takes to reach the destination.

Example:

traceroute google.com

This will display each hop on the way to Google's server and the response times for each.

  1. nslookup

Queries DNS to retrieve domain name or IP address mapping.

Example:

nslookup google.com

This will display the IP address associated with google.com.

  1. dig

Another tool for querying DNS records, providing more detailed output compared to nslookup.

Example:

dig google.com

This will give detailed DNS information about the domain google.com.

  1. route

Used to show or manipulate the IP routing table.

Example:

route -n

This displays the kernel's IP routing table, showing the available routes.

  1. iptables

Used to configure the Linux kernel firewall for packet filtering.

Example:

sudo iptables -L

This will list all the current firewall rules in place.

  1. curl

A tool to transfer data to or from a server using protocols such as HTTP, FTP, etc.

Example:

curl http://example.com

This command fetches the HTML content of example.com.

These commands are essential for diagnosing and managing network configurations on a Linux system.

Top comments (0)