Instructor: Shell, what is a shell?
In this lesson, we will cover about the shell.
How shell works,
and how you can run commands within the shell,
or how an environment is set up in a shell.
So, what exactly is a shell?
Okay, so shell is like a container,
like you know, you have like a Tupperware in your home,
or any other kind of containers
that hold your vegetables or your leftovers, right?
Just like that, a shell is like a Tupperware
of an operating system which holds the environment,
your information inside of it.
It interfaces between users and kernels,
or operating systems.
So, you have built-in operating system
and that provides you a platform
for you to execute commands.
Again, Windows is one of the platforms,
and it provides a Window operating system with a GUI shell.
When you start up a GUI, you execute commands by running,
or double clicking on a program, right?
So, that GUI interface is your shell.
Now in Linux when you don't have a GUI,
you are given a terminal shell or a prompt,
or CLI command that is your shell.
To find your shell in Linux,
you could run a command like echo $0.
That will tell you which shell you are in,
and you could also get a listing of all your shells
in your Linux distribution
by running the command, cat/etc/shells.
Your shell is also inside of the etc/passwd
that is defined inside of a file,
which tells you the type of shell a user is assigned to.
Windows GUI is a shell, Linux KDE GUI is a shell,
Linux sh, bash, and other shells,
are provided to the user as well.
All are like a container or a shell.
Again, let's look at the diagram here.
Look at the second from the top.
You will see that the application talks to the shell,
and then shell talks to the kernel,
and Kernel is the one that is telling hardware what to do.
Let's look at our Linux machine,
and we will see how we could find our shell.
We'll open a terminal real quick,
and we will enter the command, echo $0.
It tells you you are in Bash and that's your shell.
So you could look at the available shell
that is installed in your distribution as well.
Now by doing a cat/etc/shells,
it tells you all the shells that are available
in your operating system.
And when you look at the etc/passwd,
or cat/etc/passwd,
you will see in my username, which is right here,
and the shell that is assigned to it.
It tells you that the shell is specified
at the end of the line indicating that I have defined shell,
which is /bin/bash, right?
I could change that shell if I want to
into a different shell,
but I try to keep it consistent with other users.
So, this is what the shell does.
We'll cover in the later lessons
how we could talk to shell,
to create scripts and other things to automate our tasks.