In this chapter, we’ll explore linux networking basics using command line. You’ll learn how to use commands like ping, curl, ifconfig and others to interact with networks, troubleshoot connectivity, and transfer data. By the end of this chapter, you’ll be able to diagnose network issues, download files, and configure basic network settings.
Summary
This guide covers essential Linux networking tools for Debian 12, from basic commands like ping and wget to advanced tools like nmap and tcpdump. Practice these to build a solid networking foundation.
Linux Networking Basics
Linux networking basics equips you with essential skills to manage and troubleshoot networks on Debian 12. Learn to use commands like ping, curl, ssh, and ip to check connectivity, transfer data, secure remote access, and monitor network activity, ideal for beginners handling everyday tasks like browsing, file sharing, or remote work.
Note: Most tools are pre-installed on Debian. Install others with apt (see Chapter 15).
Why Learn Linux Networking Basics?
Networking is vital for connecting devices, accessing online resources, and managing remote systems. Mastering Linux networking basics empowers you to troubleshoot connectivity, secure data transfers, and optimize network settings, whether you’re a home user, student, or small office worker.
Basic Networking Commands
ping: Test Connectivity
Sends ICMP requests to check if a host is reachable.
- Ping a host:
$ ping google.com
- Limit to 5 packets:
$ ping -c 5 google.com
Advanced Usage:
- Set packet interval (e.g., 0.5 seconds):
ping -i 0.5 google.com - Flood ping (requires root):
ping -f google.com
Alternatives:
hping: Send TCP SYN packets:hping -S -p 80 google.comnping: Send ICMP echo request:nping -c 1 --icmp google.comfping: Ping multiple hosts:fping google.com facebook.com
curl: Transfer Data
Fetches or sends data via protocols like HTTP/HTTPS/FTP. For detailed usage, see the section below.
- Download a file:
$ curl -O https://example.com/file.txt
- POST request:
$ curl -X POST -d "name=value" https://api.example.com
wget: Download Files
Downloads files from the web, supporting recursive downloads. For detailed usage, see the section below.
- Download a file:
$ wget https://example.com/file.txt
- Background download:
$ wget -b https://example.com/file.txt
dig: DNS Lookup
Queries DNS servers for domain information.
$ sudo apt install dnsutils $ dig google.com
Advanced Usage:
- Get only IP address:
dig +short google.com - Query specific DNS server:
dig @8.8.8.8 google.com
Alternatives:
host: Simple DNS lookup:host google.comnslookup: Interactive DNS query:nslookup google.comdnstracer: Trace DNS delegation:dnstracer google.com
whois: Domain/IP Information
Retrieves registration details from the WHOIS database.
- Lookup a domain:
$ whois google.com
- Lookup an IP:
$ whois 8.8.8.8
Advanced Usage:
- Query specific WHOIS server:
whois -h whois.無料 google.com - Verbose output:
whois -v google.com
Alternatives:
digwith WHOIS-like output (limited):dig +whois google.com- Web-based tools: whois.net, DomainTools
Network Configuration
ip: Manage Interfaces
Displays and configures network interfaces.
$ ip addr
nmcli: NetworkManager CLI
Manages network connections via NetworkManager.
$ nmcli con show
Network Diagnostics
ss: Socket Statistics
Shows socket and connection details.
$ ss -tuln
traceroute: Trace Packet Path
Traces the route packets take to a destination.
$ traceroute google.com
mtr: Real-Time Diagnostics
Combines ping and traceroute for live network analysis.
$ sudo apt install mtr $ mtr google.com
Advanced Usage:
- Generate report:
$ mtr -r google.com - Limit cycles:
$ mtr -c 10 google.com
Alternatives:
traceroute: Basic path tracing:$ traceroute google.comtcptraceroute: TCP-based tracing:$ tcptraceroute google.com
nload: Bandwidth Monitoring
Monitors network bandwidth usage in real time.
$ sudo apt install nload $ nload
Secure Networking
ssh: Remote Access
Securely connects to remote systems.
$ ssh user@remote_host
scp: Secure File Transfer
Transfers files securely between hosts.
$ scp file.txt user@remote_host:/path/
Advanced Networking Tools
nmap: Network Scanning
Scans networks for hosts and services.
$ sudo apt install nmap $ nmap 192.168.1.0/24
tcpdump: Packet Capture
Captures and analyzes network packets.
$ sudo tcpdump -i eth0
httpie: User-Friendly HTTP Client
Simplifies HTTP requests with a user-friendly interface.
$ sudo apt install httpie $ http GET https://api.example.com
Practical Examples
Test connectivity: ping -c 10 google.com
Download a webpage: wget https://example.com
Check DNS: dig +short google.com
Practice Time!
- Ping a website and limit to 5 packets.
- Use
curlto download a file. - Trace the route to a server with
mtr.
Glossary of Commands, Tools, and Shortcuts
| Command/Tool | Description |
|---|---|
ping |
Tests network connectivity. |
curl |
Transfers data via various protocols. |
wget |
Downloads files from the web. |
dig |
Performs DNS lookups. |
whois |
Retrieves domain/IP registration info. |
ip |
Manages network interfaces. |
nmcli |
Controls NetworkManager. |
ss |
Displays socket statistics. |
traceroute |
Traces packet paths. |
mtr |
Real-time network diagnostics. |
nload |
Monitors bandwidth usage. |
ssh |
Secure remote access. |
scp |
Secure file transfer. |
nmap |
Network scanning. |
tcpdump |
Captures network packets. |
httpie |
User-friendly HTTP client. |

Detailed Note: Wget and Curl
Wget
wget is a command-line tool used to download files from the internet. It supports HTTP, HTTPS, and FTP protocols, and can be used to download files from websites, FTP servers, and other online sources.
Typical Use Cases:
- Downloading files from websites
- Downloading files from FTP servers
- Mirroring websites or FTP servers
Example Usage:
$ wget https://example.com/file.txt
This will download the file file.txt from the website https://example.com and save it to your current directory.
Advanced Use Cases:
- Recursive download:
$ wget -r https://example.com - Resume interrupted download:
$ wget -c https://example.com/largefile.zip - Limit rate:
$ wget --limit-rate=200k https://example.com/file.txt
Curl
curl is a command-line tool used to transfer data to and from a web server using HTTP, HTTPS, SCP, SFTP, TFTP, and other protocols. It can be used to download files, upload files, and send HTTP requests.
Typical Use Cases:
- Downloading files from websites
- Uploading files to websites
- Sending HTTP requests to web servers
Example Usage:
$ curl https://example.com/file.txt -o file.txt
This will download the file file.txt from the website https://example.com and save it to your current directory.
Advanced Use Cases:
- Send POST request:
$ curl -X POST -d "data=hello" https://example.com - Authenticate:
$ curl -u user:pass https://example.com - Follow redirects:
$ curl -L https://example.com
Alternatives
Wget Alternatives:
curl: More versatile for data transfer.aria2: Multi-protocol download tool:
$ aria2c https://example.com/file.txt
Curl Alternatives:
wget: Simpler for downloads.httpie: User-friendly HTTP client:$ http GET https://example.com
Differences Between Curl, Wget, and Command-Line FTP Tools
curl excels in flexibility, supporting numerous protocols and data transfers, while wget is optimized for downloading with features like recursion. Command-line FTP tools like ftp or lftp focus on FTP-specific tasks, lacking the broad protocol support of curl or the simplicity of wget.

That’s it for Chapter 17 , Linux Networking Basics ! You’ve now learned how to use networking commands to diagnose issues, transfer data, and configure network settings. In the next chapter, we’ll dive into compiling programs—how to build software from source code. Until then, practice these commands to become more comfortable with networking in Linux.
Previous: Chapter 16 | Next: Part III