Essential Linux and Raspberry Pi command line tools for network troubleshooting are covered, including ping, ifconfig, ip, dig, traceroute, arp, netstat, hostname, and route. Each command is demonstrated with practical examples showing how to test connectivity, query DNS, inspect interfaces, and examine routing tables.
Linux CLI Troubleshooting Tools
Here I am on my Raspberry Pi, my demo Pi here, and we're going to go over a few commands that you can do for troubleshooting purposes. I did a similar walkthrough with Windows and I went over some commands, so I'm going to repeat some of those, such as ping.
I can ping an address, and what it's doing is testing the connectivity to that address. So the first one here is the ping, and I see that I have connectivity to it. One thing that we see that's different about this is, on a Windows machine, to continually repeat a ping to something we have to do a dash t, where this just automatically keeps going and I have to hit Ctrl+C to end this and stop it from pinging. And then it gives me this little summary, which is kind of cool, about how many packets were transmitted and how many lost. So then we got some good information on what the delay is to this address right here.
Another one on the Windows machine that we covered was ipconfig, but a similar command on this is ifconfig. So we do an ifconfig and it will show us the interfaces that are on this device and some information about those interfaces.
Similar to ifconfig, we also have ip. So we could just type in ip, and maybe we want to see addresses. Then I can say ip address and it will pop in with some information about the addresses on the different interfaces. Or, if I just type in ip, it will tell me exactly what commands I can work with. So if I need to find out certain information, then I can find out that information — such as, how about ip route. I can type in ip route and then it'll give me some information about the route.
Windows has nslookup installed, so we can do DNS queries and test out DNS. Now, we need to install another application on a Linux machine in order to make this happen.
So what I'm going to do is a sudo apt-get update, so I can update all the repositories and make sure I have everything up to date. Then, once I do that, I'm going to download the dnsutils program, so that way I can use dig and actually look up some of this information. So I'll do a sudo apt-get install and we're looking for dnsutils. Hit enter, and then I'll go through the process of installing this with all of its dependencies. I'm going to confirm yes, and there it is installing everything.
I can verify the installation by typing in dig -v. I can hit that and then it shows that yes, in fact it is installed. So let's try using it. I'm going to do a dig on www.google.com. Hit enter and see if it comes back with an address. We see in here it did a search for www.google.com and has come back with an IP address. It's the A record in here. So we are good to go.
Similar to Windows, we have traceroute. This one actually is specified as traceroute rather than tracert. Then we specify what we are tracing this to, so we'll trace it to google.com and hit enter. It goes through the process. This one actually went much quicker, but we can see all of the hops that it took between here and getting to that www.google.com.
These machines do have an ARP table on them as well. So I'm going to type in arp -a and we're going to take a look at the ARP table. We see here the IP addresses and their associated MAC address, and which connection it is on. So we do in fact have this ARP table, and we can look up the ARP table for troubleshooting things.
The next one that we're going to take a look at is netstat. Netstat is going to show us all of those connections, all the network connections that we have connected. So it's showing us all of these connections that we have in here. Netstat can be used as one of those things to see if there are some issues and what is connected to this device.
Same as Windows, we can type in hostname and we will see what the host name here is. The host name of this device is raspberrypi.
The last one we're going to take a look at is the route command. The route command once again shows us the routes there are to get to different networks. So it's showing us the different routes here, and then the default route — how to get to the outside world, how to get to the internet.
These can be really helpful as you're trying to gather information.
TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.
Explore free tools and programs →