In this tutorial, you'll learn how to use the command line interface to reveal information about your network and also to change network processes.
We’ve already seen that you can use the CLI to perform tasks on your own computer in this tutorial. You can display, move and copy files and folders and see the programs that are running. But there are a lot more capabilities of the CLI that deal with extending to other computers and networks.
When a website is requested and viewed, there are data packets that are sent back and forth. There’s a ton of information about your network that can be displayed using commands in the CLI. How about we check out a few? The commands vary a bit depending on whether you are using a Windows, Mac, or Linux computer.
The ipconfig
command is typically used on Windows systems while ifconfig
is used on Macs and Linux computers. This command displays the network settings of all network adapters on your computer. It can be used to ensure that your network is up and running. You can also enable or disable a device, although you’ll need superuser or admin permissions.
The commands netsh
and networksetup
are used in a lot of different ways to change and modify network settings.
These two commands, nbstat
and netstat
- again depending on which operating system you are using, will display all connections and listening ports. What this means is that it basically lists all of the ways that you can connect to other networks. It can also be used to display a routing table which is a list of specific routing destinations. When your router receives a data packet, it uses this table to know where to send that data. A routing table is essentially a map for the router.
The traceroute
or tracert
command is a pretty cool one. What you can do with this is follow your data packets along the route of your Internet request. You’ll be able to see all of the different “hops” that were used and how long each took.
The ping
command is used to verify that a host is reachable by sending data packets to another destination and waiting for a response. Once you stop the ping, you can view the statistics of how many packets went through and how many were lost. The command pathping
is very similar for Windows operating systems and combines the previous tracert
command with this new ping capability. Not only will it trace the route of a data packet, but will also send pings to test its reachability. It is used to locate spots that have network delays and network loss.
CLI Detective
Watch the following video and follow along with the prompts.
Answer the following questions based on the video.
Answers are at the bottom.
Mac CLI
Explore this simulation of a terminal window for a Mac. It works best if you click on the Open button to start the simulation. This will open the simulation in a new window. There are many elements that are interactive but not all capabilities or functions are available.
Available Commands:
ls
pwd
sudo ps
ifconfig
netstat
traceroute codehs.com
ping codehs.com
Windows CLI
Explore this simulation of a terminal window for a Windows operating system. It works best if you click on the Open button to start the simulation. This will open the simulation in a new window. There are many elements that are interactive but not all capabilities or functions are available.
Available Commands:
dir
cd
tasklist
ipconfig
nbstat
tracert codehs.com
pathping codehs.com
Command Line Detective Answers:
The person changed the name of their network adapter from Wee-Fee to Wi-Fi.
The person “pinged” google to check the connection, see how many packets were sent and received, and how long it took.