Hi Guys…!!!… In this blog we are going to discuss Useful Things You Can Do with Command Prompt. So, let’s get started…
What exactly is cmd?
Well, I’m sure most of you have a pretty good of what cmd is, but in case you don’t.
Consider it like this, to access our Windows computer, most of us use GUI, i.e. Windows explorer to create a folder, copy files, and to move around in different directories, etc.
But initially, when the PCs were just basic, the terminal was the only way to access the computer.
But then computers got powerful, we had images, video, and internet, and the terminal was replaced by a GUI.
And it makes sense, why use cmd, when you can do the same thing much faster and intuitively with a GUI.
But, there are certain things where cmd still has an edge.
The same reason why network and system admins still prefer the command line over GUI it’s faster.
In this video I’m not going to talk about basic cmd stuff like copy file, changing colors and playing star wars, etc.
They are not useful and you will never use them. At least, I don’t.
However, there are certain cmd commands that I still use to this day.
So, let’s check them out.
#1 C:\ ping Command
The ping command is like a sonar it sends a data packet to the target machine and they reply.
And based on that ping time, you get to learn two things.
One of the remote machine is up and if it is.
Second then how far is it?
For instance, if I ping 127.0.0.1 (which is localhost or this computer), you can see the TTS or time take for a round trip less.
Meaning the connection is fast, which makes sense, since the computer is talking to itself.
The packets are not leaving this system.
Now, if I ping other devices on my network, say my phone, then you can see that it takes more time meaning the device is a little bit far but still relatively close.
This also tells you, if the other device is ON or not, meaning if I close the disable the internet on my phone, the ping goes down as well.
So, if you are a parent wanting to know if the child is sleeping or up with his computer in his room.
Simply find out their system IP address (using a router or 3rd party apps like fine) and then ping that IP address.
If the ping replies, chances are they are still not asleep.
Similarly, when the internet shuts down, the first thing I do to troubleshoot it is to ping the router IP address.
If I’m getting a reply, it means the connection b/w my computer and router is fine.
And there is a problem at the ISP end.
But, if I’m not getting any reply, then the router could be either down or there is a problem in the line between me and the router.
Similarly, you can also ping a web server to find out if the website is down or just slow..
For instance if you are playing FIFA on EA server, doping utas.fut.ea.com, if the ping is more than 100 ms.
It means the connection is garbage, you’ll lose the game even if you react in time.
#2 C:\ ipconfig command
The ipconfig command In simple words, ipconfig command on Windows; also known as Ifconfig on Linux/mac is used to find your computer’s.
Network details, such as the address of its default gateway, IP address of your router’s, the IP address or mac address of the computer.
Simply type in ipconfig /all and it will release a bunch of information about your computer.
Like the hostname, When you are connecting this device on the network using smb sharing, then you need to type in the same name, Physical address is the mac address of the computer, but as you can see there are multiple mac or physical address.
So if someone is asking me to give my mac address what I’m supposed to tell?
Well, most computers have more than one network card, but the computer at any given instance uses only one, so you need to look for the mac address that has an IP address associated with it.
This will be your mac address, IPv4 is the IP address, the default gateway is the IP address of your router, if you type this address it’ll open the router login page, and DNS server shows what are your current DNS server is, if it starts with 192.168, etc, it means, you are using the default DNS provided by your ISP.
but you always have the option to change it to custom one like SDP to bypass geo-restriction on video streaming sites, google DNS for faster internet, OpenDNS if you want to block adult or objectionable content on your network.
If you change your DNS server, the effects won’t necessarily take place immediately.
Or sometimes the internet is just not working on one device but it’s working fine on another device on the network.
In such cases, you can flush the old DNS from the system by typing Ipconfig /flushdns Similarly whenever I experience a flaky internet connectivity the first thing I do is reset the connection by typing ipconfig /release, which releases the connection (so don’t do this if you need to be connected to the internet).
Next, just type ipconfig /renew to reconnect to the internet with a new IP address.
C:\ SFC Command
The SFC command Windows includes a system file checker tool that scans all the Windows system files and looks for problems.
If system files are missing or corrupted, the system file checker will repair them.
This may fix problems with some Windows systems.
To use this tool, open a Command Prompt window as Administrator and run the SFC /scannow command and wait for it to do its thing, which can take five to ten minutes depending on your system.
Overall, if you have difficulty to diagnose issues, try it, as it’s a useful baseline action to take when your operating system is acting weird.
C:\ Netstat Command
Netstat command Your PC makes a lot of Internet connections when you are using it, while most of these connections are harmless, there is always a chance that you have some malware, using your Internet connection in the background without your knowledge.
If you suspect a malicious program running in the background, you can check it with the netstat command.
Open cmd with admin privilege and type in netstat –abf 5 The –a option tells it to show all connections and listening ports.
The –b option adds what application is making the connection to the results.
The –f option displays the full DNS name for each connection option so that you can more easily understand where the connections are being made.
The 5 option causes the command to poll every five seconds for connections.
As you can see there are dozens of connection made to the internet, and most of them are windows processes trying to update to or do security check, but if you detect something malicious connected to the internet, you can do the nslookup of their IP address to see what they are.
Most of the time it’s not clear what programs are running, so I usually look for process ID which is always unique and then go to task manager and look for the same process id and try to identify the software, by looking at the – show device location option.
And if it sounds like a malicious program, (use google to confirm) then it’s better to get rid of it.
C:\ nslookup Command
The nslookup command Every device that connects to the internet has an IP address.
Your computer has an IP address, your smartphone has an IP address, your smart cars have IP addresses and every website has an IP address.
Because after all,
A website is just a bunch of files running on powerful computers that are connected to the internet 24/7.
And when you type a domain name (say, into a browser address bar), your computer looks up the IP address associated with that domain name.
You can use the nslookup command to find that information out for yourself.
you could type nslookup google.com at the Command Prompt to quickly find out our server’s assigned IP address.
What is the use?
Sometimes if the websites are blocked on your network using the host file method.
Then you can use nslookup to find the IP address of the website,
like nslookup facebook.com and then type the IP address on the browser to access the page.
You can also perform a reverse lookup by typing an IP address to find out the associated domain name.
You got an email for an IP address or you see an IP address on your system setting that you are not familiar with,
You can do a reverse DNS search. like nslookup 188.8.131.52 will tell if its google DNS.
C:\ tracert Command
The traceRT command The tracert command traces the route it takes for a packet to reach a destination and shows you information about each hop along that route.
For example, if you run tracert google.com,
you’ll see information about each node the packet interacts with on its way to reach our server.
First the connection goes to your router, so I know my router is fine.
Next, it goes to my ISP bsnl in my case,
Fun fact, most ISPs in India including the govt-owned bsnl leases internet from tata and reliance.
These are the only 2 providers in India.
Now depending on which port they go (there are 4 in India Mumbai, Chennai).
For me it’s a channel then it goes to Singapore using the underwater tunnel.
Which further goes to different service providers before it reaches, the my final server.
In a nutshell, If you’re having issues connecting to a website,
tracert can show you where the problem is occurring, is it router, your ISP, or a particular server.
Well, this is all for now, I hope you learned something useful today