Jump to content

Five Essential Linux Networking Commands

From WikiInfo

Five Essential Linux Networking Commands

Here is a summary of five widely recognized and essential Linux networking commands used for troubleshooting, information gathering, and configuration.


1. ip (or ifconfig)

This command is used to display and manipulate network interface information. ip is the modern replacement for the older, but still common, ifconfig.

  • Function: View IP addresses, network device status (e.g., active/inactive), and manage routing tables.
  • Example Usage: ip addr show to display addresses, or ifconfig for a basic overview.

2. ping

ping is the fundamental tool for testing network connectivity between your system and a remote host.

  • Function: Sends ICMP echo request packets to a target IP address or hostname and measures the time it takes for a reply (round-trip time).
  • Usage: ping google.com or ping 8.8.8.8.

3. ss (or netstat)

The ss (Socket Statistics) command is used to display network connections and socket information. It is the improved replacement for the older netstat.

  • Function: Shows listening ports, active network connections, routing tables, and interface statistics. This helps in identifying which services are running and open ports.
  • Example Usage: ss -tuln (shows TCP/UDP connections and listening ports in numeric format).

4. traceroute

This diagnostic tool traces the path (hops) packets take from your system to a specified destination host.

  • Function: Identifies all intermediate routers (hops) and measures the transit time to each, helping to locate where network delays or connectivity issues occur.
  • Usage: traceroute example.com.

5. dig (or nslookup or host)

These commands are used for DNS (Domain Name System) lookups to query DNS servers.

  • Function: Resolves hostnames to IP addresses, retrieves DNS record information (like A, MX, CNAME records), and helps troubleshoot name resolution issues.
  • Example Usage: dig example.com (shows detailed DNS information).