Networking Commands in Linux || Day 27

Networking Commands in Linux || Day 27

Introduction:

In this step-by-step guide, we will explore various networking commands in Linux that are commonly used to troubleshoot and manage network connections. These commands are essential for network administrators and anyone looking to diagnose network-related issues. We will cover commands like Ping, ifconfig, Traceroute, Netstat, dig, ss, nslookup, host, arp, hostname, curl, and wget.

Ping:

  1. The Ping command is used to test network connectivity between your system and another host. To use Ping, open a terminal and enter the following command:
ping <hostname or IP address>

Replace <hostname or IP address> with the target you want to ping. You'll see responses indicating the round-trip time and packet loss.

ifconfig:

  1. The ifconfig command displays information about network interfaces on your system. To list all network interfaces, use:
bifconfig

You'll see details like IP addresses, MAC addresses, and network configuration.

  1. Traceroute:

    Traceroute helps trace the route packets take to reach a destination. To use Traceroute, enter:

traceroute <hostname or IP address>

It displays a list of intermediate routers and their response times.

Netstat:

  1. Netstat provides information about active network connections. To list all network connections, use:
netstat -tuln

This command shows listening ports and established connections.

dig (DNS Lookup):

  1. Dig is a powerful tool for querying DNS (Domain Name System) servers. To check DNS records for a domain, use:
dig <domain>

It displays DNS-related information for the specified domain.

ss:

  1. The ss command is an alternative to netstat for displaying network socket information. To list all sockets, use:
ss -tuln

It shows socket details like netstat.

nslookup and host:

  1. Nslookup and host are used for DNS-related tasks. To query DNS records for a domain, use:
nslookup <domain>

or

host <domain>

Both commands provide DNS information for the given domain.

arp:

  1. Arp is used to display and manipulate the ARP (Address Resolution Protocol) cache. To view the ARP cache, use:
arp

Hostname:

  1. The hostname command displays the system's hostname. To check your hostname, simply enter:
hostname

Curl:

  1. Curl is a versatile tool for transferring data over various protocols. To download a webpage, use:
curl -o index.html www.example.com

This saves the HTML content of the specified URL to a file named index.html.

wget:

  1. Wget is a command-line utility for downloading files. To mirror a website recursively, use:
wget --mirror www.example.com

This downloads the entire website for offline viewing.

Did you find this article valuable?

Support Aqib Hafeez(DevOps enthusiast) by becoming a sponsor. Any amount is appreciated!