Curl and ping commands, why do we need them?
Well, those two commands are so useful when you are troubleshooting system, network related issues.
So if you are a system administrator and you get a call.
From someone who says, hey, Mike, Mike, the server is not reachable or this machine is out or down,
or I cannot ping this address or I cannot reach this Web site.
So what are the first few things that you need to do?
Well, first thing and are that you try to communicate to that show or your cell to see if you could
reach it.
Right.
So how are you going to communicate to it?
So there are two very basic commands.
One of them is cruel.
And the second one is Peng.
So you have this Google website that you go on Windows, you log in, you go to Google dot com, perfect.
You could reach it.
So you know how it is.
But what if in Linux systems you don't have the GUI or you can open a Web browser?
You have to find out how that works.
Right.
Just like the W get.
So for that we have in Linux we have Kerl now Kearl is pacifically is for the euro.
So as you can see it's C and then you are L, so you grab that you are and see whether you could get
to that specific HTP site so you could ping the site.
Let's say if you are paying Google dot com it will come back with the IP address.
They will try to ping that IP address and you will see, hey, the server is up, OK, but if the servers
up, what if the page is not up for the server and the page is actually run by what?
It's run by a Pachi.
Right.
HPD what if the server is up and pages down?
Then you need this call command, which is very handy command to find out if that page is up.
And of course the other one is the ping pong.
You you ping the server if you are server A and you wanted to see if the server B is up or not, you
ping that server by its hostname or by its IP address.
So the example and then next for Kearl is that you specify the HTP and entire You URL and it will bring
you back the content of the page exactly the way it looks when you open up a browser, but it will bring
up all the HTML source code, most likely, or some other information.
But when it brings it back, it means the page is up.
Then you also have Kerl minus oh upper case option.
If you wanted to download a file, remember we could use w get command as well.
Well in some computers if you don't have it, you could use curcumin to download a file to your next
machine.
And of course at the end we have Pangu if you want to pingo server by hostname which is let's say Google
dot com or your system hostname with a fully qualified domain name, you could use Pinkman.
So we will try a and paying one by one in our Linux machine.
So this is my Linux machine, and this time I wanted to log into the next machine to Pudi, so before
we get into the PUDI, I need to know the IP address of my machine.
And my IP address is right here.
You'll see when I to 161 to 20.
So now if you see that one eight two always comes up.
If you have the network adapter set as Bridgit adapter and if you are connecting to the Internet through
wireless, make sure the name is connected to wireless, or if you are hardcoded with the wire then
you pick the wire cable connection in the name anyway.
So I know the IP address.
Now I'm going to open up a putty session and I'm going to put in my IP address one to one, 68 to one
20, I believe.
Let's confirm it one more time.
Yes, it is 20.
I'm going to go ahead and click open.
Log-in Drut.
OK, so I am logged in as rude I who confirmed that I'm rude and also by the prompt right here, this
is the prompt as pound.
So I'm going to make this a little bigger as well.
So.
Now, let's say if I wanted to go to a website and I wanted to make sure the website is up or not,
so let's try our simple Web site, as always, Google.
Hit enter.
And you see all that stuff that came up on the screen, there's so much other stuff, too, but you
don't really need to worry about what that stuff is or how to decrypt that or how to understand the
e-mail, to understand that all you have to do if you run the curl followed by the hostname or the euro,
and you get this entire page with HTML coding and stuff like that, then it means that you like your
website is up, you could reach it.
Good.
So if you wanted to spend it so you could do ping www.youtube.com this will only ping the IP address
of the Google.
You see the IP address of the Google right here.
Two one six 58, one seven 68, so it could change, so you could hang it by the host name, which is
Google dot com, which is your URL, or you could coping by the IP address.
So let's say if I ping it by IP address to one six dot fifty eight two one seven, that's sixty eight.
And see you getting a response back and that is Google you can always do.
And as to look up on this to find out.
Which website is that and you will see this Web site belongs to these names and these names translates
to which is the point, a record translates to Google.
Anyway, what if you wanted to download a file from from the Internet using curcumin?
For that, you need to know the exact URL for for the file that you're downloading.
So I have on my browser, I have a page open which is download PUDI.
So if you know, you could just go to, let's say, Google and.
And type download Pudi.
It will bring to bring you to this page, click on Go to Download.
And you see right here, this is the MCI file, which runs on Windows.
We are now trying to download it on Unix or anywhere but in Windows.
Then you could use this one if you're trying to download on Linux and you could use this one anyway.
It doesn't really matter for this lesson because I'm just trying to explain to you how you could download
it so you could pick anyone.
Let's see if I picked this one right.
Click on the link.
And you see right here says copy, link, address.
Click on that.
Once you copy it, you verify the link by opening up your notepad.
And then you pasted here, you see this is the entire link for that tautologies file.
Now go back to your PUDI session and now at this time type Kearl.
Dash uppercase.
Oh, and right, click.
Which will paste your copied link to your screen once you have that, go ahead and enter.
And you'll see it's downloading it, it tells you the statistics of the download.
Now, is it downloaded?
Where is it downloaded?
When it will download whichever directory you are in, you are in flash route.
So we are in route and let's see if we could verify to a cell.
And you will see right here, this is.
The file that we just downloaded today with today's date and time, so this is how you download if you
don't have a GED or if you wanted to specifically download through the euro, this Kearl and Pangu command
are very useful.
Also, a lot of people in interview would ask, tell me the commands or different ways that you could
troubleshoot.
If a server, a cannery's would be, then you could simply mention that you're going to use the PIN
command, you're going to use the call command.
If it's a Web URL, you're going to use different commands to check it.
Also going back to paying, if you are pinging Google and you will notice that this is going to ping
continuously.
Now, sometimes if you are on Windows machine and you try Penghu will, it will ping it three times
and will stop.
So to use that ping on a Windows machine, you would have to, I believe, use the option minus S or
minus T one of those options.
So please try it.
I'm I'm I'm very sure that one of the minus to your mind's eye absorption.
I'm not I'm sorry, I don't have the exact option, remember right now.
But try those.
It will ping continuously and you will see that packets are dropped or what how long this is taking
for the ping to go and ping and come back.
So these are the two basic commands that I wanted to cover with you.
Try them out and just play around with it.
All right.