Script Valley
Linux Basics Complete Course: From Beginner to System Administrator
Module 6: Networking and Package ManagementLesson 6.1

Linux Networking Commands | ping curl wget netstat

ping, curl, wget, netstat, ss, ifconfig, ip addr, Linux networking basics

Linux Networking Commands

Networking is a fundamental part of Linux system administration. Whether you are troubleshooting connectivity, downloading files, or checking which services are listening on which ports, Linux provides a comprehensive set of networking commands. These tools are used daily in server management, DevOps workflows, and network diagnostics.

Checking Network Interfaces with ip and ifconfig

The ip command is the modern replacement for the older ifconfig command. Use ip addr to display all network interfaces and their IP addresses. Most Linux distributions still have ifconfig available via the net-tools package.

ip addr
ip addr show eth0
ifconfig
ifconfig eth0

Testing Connectivity with ping

The ping command tests network connectivity by sending ICMP echo request packets to a target host and measuring the round-trip time. It is the first tool to use when diagnosing connectivity issues.

ping google.com
ping -c 4 8.8.8.8
ping -c 3 192.168.1.1

The -c flag limits the number of packets sent. Without it, ping runs indefinitely until you press Ctrl+C.

Downloading Files with wget and curl

The wget command downloads files from the web. It supports HTTP, HTTPS, and FTP and can resume interrupted downloads with -c. The curl command is more versatile — it sends HTTP requests and can display response headers, post data, and interact with REST APIs.

wget https://example.com/file.tar.gz
wget -c https://example.com/large-file.iso
curl https://example.com
curl -I https://example.com
curl -O https://example.com/file.zip
curl -X POST -d "key=value" https://api.example.com/endpoint

The curl -I flag fetches only the HTTP headers. The -O flag saves the file with the same name as on the server. The -X flag specifies the HTTP method.

Checking Open Ports and Connections with ss and netstat

The ss command (socket statistics) shows open sockets and network connections. It is the modern replacement for netstat. The -tuln flags show TCP and UDP listening ports with numeric addresses.

ss -tuln
ss -tulnp
netstat -tuln
netstat -an | grep :80

The -p flag shows which process owns each socket. This is invaluable for determining which application is listening on a specific port.

DNS Lookup

The nslookup and dig commands perform DNS lookups, translating domain names to IP addresses. The host command is a simpler alternative.

nslookup google.com
dig google.com
host google.com

Up next

Linux Package Management | apt and yum Tutorial

Sign in to track progress