July 27, 2026
Your guide for Linux network troubleshooting commands
If a server becomes unreachable or application suddenly stops you look up what is the problem and you find out your connection is lost and…
By Hamza Ali
3 min read
If a server becomes unreachable or application suddenly stops you look up what is the problem and you find out your connection is lost and Internet is down.
You quickly check your phone, and the internet is working perfectly . The problem isn't your network it's your machine. That's when it's time to put on your troubleshooting hat.
It doesn't matter if you know many Linux commands it all comes down to knowing which one to use and when to use. As the famous saying goes:
"Less is more"
Network trouble shooting can be overwhelming but if you know what guided steps to follow, life become much easier.
1. ifconfig
It is the OG networking command in Linux, It displays information about your network interfaces, IP address, MAC address, Subnet mask.
ifconfigifconfigProbably the first command you will use when your connection is down.
Think of it as a snapshot of your machine's network configuration. It lets you quickly verify whether your interface is up, whether you've been assigned an IP address, and what MAC address and subnet mask are currently in use.
Basically gives you an overview of your network configuration.
Similar to the ipconfig command in Windows.
2. ping
Ok you have seen that network interface is good, you should whether the website you are trying to reach is specifically is having some problem.
This way you narrow down the problem to see if that particular site is having issues.
ping -c 4 8.8.8.8ping -c 4 8.8.8.8If the reply is coming good on an IP address like 8.8.8.8 and there is no packet loss but when visiting the website by domain name in URL is not working on browser there likely a DNS issue, meaning your system is not able to translate domain names to IP addresses.
3. wget
While it is primarily used as a file downloader, I use it almost every day as a quick and dirty way to check network connectivity.
wget cnn.comwget cnn.comIf the network is working it will resolve the domain name, connects to the server and download the default index.html webpage to your current directory.
I really like this one since it is a handy tool to quickly check for network connectivity.
4. traceroute
Yes if you are wondering it is similar to Windows tracert.
It shows every router (hop) your packets travel through before reaching the destination.
traceroute www.cnn.comtraceroute www.cnn.comYou can use it to analyze the trace to see where in path the packet are getting lost or latency is more prevalent.
5. dig
This one is for DNS investigations.
It is used for gathering DNS information about a domain.
dig www.google.comdig www.google.comNot only used by network admins but also by security professionals to extract valuable "passive reconnaissance" before interacting with a target for pentesting or security assessment.
DNS records can reveal valuable information about a target, such as its nameservers and mail servers.
For example, I can find the University of Karachi's name servers using the command below:
dig uok.edu.pk NS
6. curl
It stands for Client-URL
It's more versatile than wget because it lets you inspect HTTP headers, send different request methods, and view response codes.
curl -I https://cnn.comcurl -I https://cnn.comA server may respond to pings while application may remain unavailable.
The -I flag grabs headers info so you know if you are getting 200 OK, or a redirect or a timeout, it is particularly useful when ping works but the actual service is not responding.
7. nmap
Nmap (Network Mapper) is a powerful open-source tool that can be used for:
- Scan ports (open/closed/filtered)
- Discover hosts on a network
- Detect services running (web server, SSH, etc.)
- Identify operating systems and versions (OS fingerprinting)
- Perform vulnerability scanning (via scripts)
Mainly used as a port scanner, but for troubleshooting I use it for checking out if a specific port on a remote site is reachable.
nmap -p 443 cnn.comnmap -p 443 cnn.comFrom a security perspective this is huge too running a nmap scan you could find out any open ports in your servers which renders the system exposed to any port-based service attacks.
8. tcpdump
The heavyweight, if everything else fails this is your last resort.
It captures raw packets on an interface so you can see exactly what is happening at the packet level.
tcpdump -i eth0 port 443tcpdump -i eth0 port 443Also used by SOC teams, a core component usually for capturing raw packets and then analyzing them in Wireshark for any suspicious activity.
Hopefully by now you have some understanding of some Linux networking commands and how to use them in your scenario. Always follow a systematic approach any network issue narrowing down your problem one step at a time.
Best way to learn these commands is to actually experimenting them in your own lab environments. Trying out different flags using the man or help pages you don't need to memorize each of them just understand when to use which one and you will be surprised of how much they will naturally become part of your network troubleshooting workflow.
Happy Networking.!