[No audio]
System utility commands.
These are very basic commands that
are being used in Linux environment.
Some of those commands are just like, in Windows
we have time, we have calendar.
Now Windows is a GUI environment and you
could view those time and calculators and stuff
like that by going to the accessories.
But in Linux it's not possible.
So that's why there are commands that are
being built that tells you to the date,
the uptime information, the hostname, the uname,
then about the operating system, which means where
the commands are located, the calculators, sorry, the
calendar and the bc is binary calculators.
Now let's look at our Linux machine
and run these commands one by one.
In Linux machine when you are logged in through the
GUI, through the console, you'll see the time here.
You also have the option to go into
the applications and pull up the calendar and
you'll see all the information that are automatically
viewed without running any command.
But what if you are logging in
through the PuTTY or the terminal client?
And as I said before, 98% of the time you will be
logging in through the PuTTY client to the terminal where you're not
going to be able to see all those GUI environment.
So let's look at the view through the
PuTTY. Again, we'll put in our IP address.
It's 192.168.56.101, and I remember by now and
if you don't, you could just simply go back
to your console and type ifconfig, enter.
And at the top right here, this is the IP address.
You punch in that IP address right
here and click on Open Terminal.
It will open up, you login as yourself.
Put in the password and you are logged in.
Once you clear the screen, and you will see here
there is nothing but the black terminal. So when you wanted to run,
when you wanted to find out what time
is it or what date it is,
you just type date.
It will tell you today is Tuesday, March
13, the time and the second and Eastern
Daylight Saving time and the year.
So that's what the date command is used for.
It's very simple, and sometimes the date command
is used to combine with the script.
So a script will wake up, it checks
the date, and it will run certain scripts,
we'll cover that in our scripting session.
The next one is uptime.
uptime simply tells you how long been the system
up for, and how many users have been logged
into the system, and the load average.
[No audio]
The next one, it tells us about the
hostname, right here, the hostname.
Let's move this little to the side. hostname,
we could go back to our console, we could
do the hostname, and you'll see this is
the hostname of our Linux machine.
And hostname is one of the important command
that I would recommend you to run every
time you log into the system,
so you would know you are not logging
into the wrong system, and you are not
running very critical commands on the wrong system.
You clear the screen.
The next one we have uname.
When you type uname, it will
tell you it's a Linux machine.
Again, in the Linux machine,
you do need to run this command because sometimes
in an environment you have Linux, you have Solaris,
you have AIX, many different Unix flavors.
So it's good to run uname.
If you want to know more details about
uname, you type uname -a.
It will give you a lot more detail than just
Linux. It will give you the hostname, the Kernel version,
the time it was built, and other architecture information.
The next command we need to learn is which. which command
tells you the location of your command that you run.
Let's say you run the command pwd, right?
And it tells you that the command is
telling you which directory you are in.
So where is that command located?
Of course, every command is a
file itself, and it's located somewhere.
To find out, you type which pwd, and it tells
you this command pwd is located in /usr/bin/pwd.
If you want to know more attributes about this command,
you will run ls l-l /usr/bin/pwd, and you
will see right here, this is the script
actually, the command itself is a script.
The script itself is a text file
that has been written by developers.
And it tells you right here it is owned
by root, and the group is owned by root,
and these are the permissions of this file.
Everybody has the right to execute it.
If I take this bit out, then I cannot
run or nobody else can run this command.
So this is what which command does.
Let's clear this out.
If you want to know where is date command located,
date command is also located in /usr/bin/date.
So, as you can see, most of
the commands are located in /usr/bin.
You do ls -l, and you
see a whole bunch of commands.
If you want to view one page at a time, you could
do more, and you could see all these commands that we have.
There are a bunch of commands that Linux has.
What if I wanted to know how
many total commands are in Linux? Very simple.
You do ls -l and if you remember,
you pipe it, you do wc -l.
This would give me the total number
of all these lines that are coming up.
It's telling me there are 1597 commands
that are inside of this Linux machine.
[No audio]
Moving on.
What if I wanted to know calendar?
If I just type cal, it will give me
the calendar of this month and this year.
What if I wanted to know the month when I was born
let's say? For training I'll do cal, September 18, 1977.
So I'll type September 9, sorry September which is a
month, 1977, and it would give me, I could look at it,
September 18 was Sunday, so you could type any
month followed by the calendar. If you just wanted
to know all the months in the year 2016.
So you just type cal 2016 and it'll give you
all those months starting with January ending in December.
That's what the cal command is used for.
Next command we have, let's clear this,
bc. bc stands for binary calculator.
If you want to do the calculation, of course
you could go in here and bring the calculator.
But you don't want to bring the calculator
GUI mode, you are in terminal mode.
So you wanted to use the calculator.
Then what you do, you type again bc, hit Enter.
Now if you want to do two plus two, hit Enter.
It will give you four.
What if 256 times 321?
That's the answer.
So this is just a basic calculator.
You could do division, multiplication,
or anything that you want.
If you want to quit out of it, just
type quit, and you will be out of it.
So these are a few system utility
commands and you could run that.
These are fun commands, come up with the different options,
and of course to look at the options,
you could do man on every
command and run with few options.
[No audio]