Photo by Gabriel Heinzer on Unsplash
Command & Conquer: Networking Essentials for the Linux Terminal (Part 3)
Into the Network: Exploring Linux Networking Commands
Welcome to Part 3 of the Command & Conquer series! After mastering file management and processes, it’s time to connect to the outside world. Networking commands are vital for troubleshooting, monitoring, and exploring connections, whether you’re a sysadmin or a cybersecurity enthusiast.
This chapter covers essential Linux networking commands that will give you a solid foundation to manage and troubleshoot networks.
Essential Networking Commands
1. ifconfig
/ ip
- View and Configure Network Interfaces
These commands allow you to view and manipulate network settings.
Syntax:
ifconfig
(deprecated but still used in older systems).ip a
(modern alternative toifconfig
).
Example:
Check interfaces:
ip a
Assign IP address:
sudo ip addr add 192.168.1.100/24 dev eth0
2. ping
- Test Connectivity
Check if a device is reachable over the network.
Syntax:
ping <host>
Example:
ping
google.com
Pro Tip: Use
ping -c 4
google.com
to limit the number of packets sent.
3. traceroute
- Trace Network Paths
Discover the route packets take to reach their destination.
Syntax:
traceroute <host>
Example:
traceroute
google.com
Install if missing:
sudo apt install traceroute
.
4. netstat
/ ss
- View Network Connections
Monitor active connections and network statistics.
Syntax:
netstat
(older systems).ss
(modern replacement).
Example:
ss -tuln
(shows open ports and listening services).
5. curl
- Interact with Web Servers
Fetch data from URLs or test API endpoints.
Syntax:
curl <url>
Example:
curl
https://api.github.com
Pro Tip: Use
curl -I <url>
to view only the headers.
6. wget
- Download Files
Grab files from the web directly to your system.
Syntax:
wget <url>
Example:
wget
https://example.com/file.zip
.
7. nslookup
- Query DNS Records
Find IP addresses for domain names and vice versa.
Syntax:
nslookup <domain>
Example:
nslookup
google.com
.Pro Tip: Use
dig
(if installed) for more detailed DNS queries.
8. nmap
- Network Scanning
Discover devices and services on a network.
Syntax:
nmap <target>
Example:
nmap 192.168.1.0/24
Install if missing:
sudo apt install nmap
.
Mini Project: Explore Your Network
Test Local Connectivity:
Run:
ping
localhost
What does it tell you about your system?
Trace a Route:
- Use
traceroute
to see how packets travel togoogle.com
.
- Use
Scan Your Network:
Run
nmap -sn 192.168.1.0/24
to discover devices on your network.Identify your router and other connected devices.
Fetch a Webpage:
Run:
curl
https://nullvoid.blog
Can you identify the headers in the response?
Why This Matters
Networking is the backbone of modern computing. Whether you’re troubleshooting connectivity issues or diving into cybersecurity, understanding these commands is essential. These tools help you map, monitor, and manipulate networks like a pro.
What’s Next?
In Part 4, we’ll explore scripting and automation, turning your newfound command-line skills into powerful workflows. Stay connected, and keep conquering the terminal! Stay null. Stay void.🤘