[No audio]
System Monitoring.
Now we are getting deep into the system administration type
of commands or roles that you will be working
on. If you really want to get a job in
system administration or systems engineering or Linux related field, you
do need to know all those system monitoring commands.
Some of them are top, df, dmesg, iostat,
netstat, free, and cpuinfo, and meminfo.
All these commands will list all the system resources and
will tell you how the system is doing, how is
it behaving, whether it's running high or low.
So let's look at them one by one by logging
into our Linux machine, log into our VM console.
[No audio]
All right, the top command you
can run without being root.
So if you notice in the top command
once again, it has cpu information, memory information,
it tells you which process it's on, which
user is running, and what command it's running.
This is again one very powerful command and you should really
spend some time to look into every field, and I would
highly recommend you to go look for the documentation or Google
it and find out more information about it. If you want
to get out of it, hit q.
The next one we have df.
df gives you your disk partition information.
You could run df minus man space df,
it tells you report file system disk usage.
We'll run df again and it tells you
the file system is mapped right here.
It has this block, this is available,
what percent is used.
Now, the most common options that is used
with df is -h. h is easier, it's
human readable, it's easy to understand.
So now it tells you we have a disk size
at the root level, which is eight gig and 3.4
gig is used and 4.6 is available and uses 43%,
it also gives you a percentage, and so on
is the memory, which is about two gig.
And then we have a boot file system
which when the system boots everything is located,
and what to boot, which files to boot.
It has one gig, and so one gig here, eight
gig here, so nine gig, and this free memory, which is
the swap, or virtual memory is about one gig.
That makes it ten gigs.
And if you remember we created our
virtual machine with ten gig and that's
what it's telling you, the partition information.
If your system is dead or crashed, one of
the things you should look into it is df
-h output, once again df -h.
And if the usage right here says 100%, or any of
the usage says 100%, then definitely you are in trouble, and
you need to free up your disk space, and you need
to find out how to free up your disk space.
You need another command that is you sorry, du.
You could do man on du and learn more about it.
It tells you the estimated file space usage,
which file is taking up all the space.
Next command we have dmesg.
dmesg gives you the output of the
system related warnings, error messages, failures or
anything like that. When you run it,
of course it throws bunch of error messages,
a bunch of information at you.
And if you want to view that one
page at a time, what do you do?
You pipe it to more. When you pipe it to more,
you will see, it gives you the BIOS information,
when the system initialized, how it went to what
CPU, if there is any issues with the memory,
it will report you right here.
If there's a memory leak, if there's an
issue with CPU that's crashed, motherboard issue.
Anything related to your system
hardware will be listed here.
And this is again one of the good things that
you should look at, if you are in system administration,
If you are going for an interview, the interviewer
is going to ask you give me the commands
that you use to monitor your system.
These are the commands, you
should list them right away.
And I'm telling you, he or she will
be impressed right away that you know your
commands, you know your system administration skills.
The next command we will learn is iostat.
IO stands for input and output statistics. What's
coming in, what's going out, how we are communicating
with our system peripheral devices or system internal devices,
even if it's a disk or network. When you run
it, it's going to give you the information right away
that the disk is being used with the read per
second, write per second, and a lot of different information.
You could also run iostat with space
one, which is telling it to refresh.
Keep running it, but refresh it every 1 second.
So it will refresh it, it will refresh it, it will keep
telling you, keep updating you to read and write.
If it is doing any read and write,
it will update it as it goes.
You could quit out of it by simply typing,
I think you have to do control C to quit out of it.
The next one we have netstat. netstat -rnv
is the option that I mostly use
if I want to find out my gateway information,
If I wanted to find out my subnet mask, and what interface
it is going through, this is the command I will use.
There are other options that you could use with netstat.
Just netstat, and if you pipe it, and you do
more, you're going to see a lot of information.
What is connected to your system, what has been
disconnected, what's the process ID, which processes is it running,
and, and the name of the owner of the process.
So it does give you all the information.
Once again, I apologize,
I cannot cover every single detail.
If I cover it, it's going to take me hours and
hours, and days and days, to cover every single command.
So my recommendation to you is just to simply
man netstat, and you look into the description of
this command, and the option of this command.
Now please do remember, I've been doing the Linux for
a very long time, and trust me, I myself don't
know every single option that a command has to offer.
If I wanted to find out or if I wanted
to look for a specific output, then yes, then I
will look into the options that is available.
But it's completely understandable that not every
person needs to remember every command or
every option associated with every command.
The next command we have free. free gives you your
physical memory, and your swap space, which is a
virtual memory, utilization, usage, and free.
The next one we have is cat. cat is to read the
file of cpuinfo. Every time your computer is started,
it keeps all its system resources information into
files and those files are located in proc.
This proc is the directory where
it keeps us all system information.
So you could just do simply cat /proc/cpuinfo, you
will find your cpu information right here.
If you want to know your memory
information you could do /proc/meminfo.
Of course it's throwing all the messages, all the
screen multiple at one shot so you could just
do simply pipe it, and more it, and you
will view it one page at a time.
So these are system monitoring commands.
You do need to remember these specific
commands on top of your head,
if you are going for an interview, if you're
going for a technical interview, or even if you
are new to Linux environment and you want to
learn more commands by monitoring the system resources, you
should look into these commands.
[No audio]