Linux - Variables
1K views
Nov 28, 2024
Linux - Variables
View Video Transcript
0:00
so now here in this particular video I'm
0:02
going to talk about some of the
0:04
variables
0:04
now what this variables are by name
0:07
itself we come to know the data which is
0:08
going to vary which is going to change
0:10
now here I'm going to use some variables
0:13
which why default you have into the
0:15
Linux operating system and the value of
0:17
this particular fryer or a particular
0:19
data of this particular file gets
0:21
changed so basically you have a profile
0:24
slash etc' slash profile when your
0:27
operating system gets started first your
0:30
system will check what you have in the
0:31
profile
0:32
nobody first want this profile content
0:34
when you get login what kind of desktop
0:36
you got what the services should be
0:38
started when you get started so
0:40
everything will be listed into that
0:42
profile and by default this file is
0:44
hidden into all the particular home
0:46
directories and your system directory so
0:49
when your system file or when your
0:51
system starts first it will search for
0:53
your profiles file that you have set
0:56
anything to be started on this startup
0:58
while your system is getting started or
1:00
you have some of this script file which
1:02
is located over here the script file are
1:05
nothing but the automated some commands
1:07
all automated some programs you have a
1:09
fight so it will check into this slash
1:11
it is a slash profile when your system
1:13
gets started if suppose it doesn't find
1:16
anything so there is nothing such like
1:18
it will provide you another because this
1:20
profile will only contain what you need
1:22
to start and what are the services you
1:24
have started while your system is
1:26
getting started if you don't find
1:27
anything what it will do it will skip
1:29
that file and then it will go to the
1:31
home directory of the user for looking
1:34
at what the user wants when it gets
1:36
local so again it will move into slash
1:39
home slash profile so slash home slash
1:41
profile will contain all the particular
1:44
user commands or all the particular
1:46
users shares or programs which that
1:49
particular user want to start again if
1:51
you would find anything the particular
1:53
program get started if it doesn't find
1:56
anything over here automatically it will
1:58
stop it over there itself or it will
2:00
skip it over there itself and then move
2:02
ahead and give the basic shell to your
2:04
particular profiles same way what this
2:08
plot file contains as I said it contains
2:11
your terminal you
2:12
such commands it will contains the type
2:14
of terminal you are going to use it
2:16
contains in which type of terminal you
2:19
are going to get long it or which we
2:21
have kept logged in same thing it will
2:23
also contain the directories list which
2:25
you already have now if suppose I want
2:27
when I get started or when I get login
2:29
in which directory I should move and
2:31
what are the directories I have created
2:34
it should be listed in to me I can also
2:36
put enter into my dot profile then also
2:39
add the variable or any particular data
2:42
which we feel that should get started
2:44
when your user get logged in so we can
2:47
also add those kind of data into the
2:49
profile which can vary or which can F
2:51
get affected while my system is getting
2:53
multiple time logged in so this is what
2:56
exactly dot profiles are now if I want
2:58
to check this dot profile file into a
3:00
particular home directory I need to move
3:02
into slash home and then again we need
3:05
to give the same command LS space hyphen
3:06
e it will show me this particular file
3:09
and let us check what this file contains
3:12
into our Linux terminal so as discussed
3:15
when your machine gets started it will
3:17
go for the profile generally we have
3:19
into this system variable or we could
3:22
say the variables which we have defined
3:23
you bring the system so if I want to
3:26
check all the variables which we have
3:28
that as well as an environment variables
3:31
so which we do not use on this shelf
3:33
what if we have you know declared into
3:35
the computer itself so that when it
3:37
starts it get access to all the
3:39
particular variables we have defined so
3:42
this are these some environment
3:44
variables which are by default defined
3:47
into the system so whenever your system
3:50
gets started it will check for all this
3:52
environment variables right like your
3:55
shell will always be been bash it serves
3:58
right your window will be the spot size
4:01
window ID will be this my size the
4:04
colors which you are going to follow
4:05
right and along with that it will show
4:09
you more of the details window path
4:13
which is the language you will be
4:15
following what is the you know a home
4:18
directory of this particular directory
4:20
so as I told you like all the particular
4:22
environment variables which are declared
4:23
it will check for each or everything
4:26
now let us have a look like what the
4:28
environment variable has been defined
4:30
into the slash home and your user
4:34
profile so as we know if I want to use
4:37
into the go into the user profile I'll
4:39
be using CD and intro so right now I'm
4:42
into my user profile that is home
4:44
trainer so if I give the command and I
4:47
won't be able to see any hidden files
4:49
and as discuss this files are by default
4:52
hidden into your profile so I'll given a
4:54
space - II and you can check please have
4:58
some read dot filenames this are your
5:01
hidden files so let us check this Aden
5:04
files by keeping come on Ln space hyphen
5:06
e so we can check the complete union of
5:09
the spots so this is your bash history
5:13
this is your bash logout bash profile so
5:16
this three files should really be have
5:18
right now right so starting with your
5:21
dot profile so dot bash profile if I
5:24
want to check the content of dash bash
5:26
profile what I'll be doing is I'll give
5:29
the command cat dot bash profile so you
5:34
know it should always follow with dot so
5:36
that comes to know it to the same father
5:38
so once you move into it you will find
5:41
that here some function has been called
5:44
and opposed that we have the user
5:46
variable which is the environment and
5:49
the starter programs we generally have
5:51
defined here so it is defining that we
5:55
need to move into the part where I'm
5:57
going to define the variable path so
6:00
whenever there is a variable declared
6:02
and it contains some values it will be
6:05
along with the dollar path so we are
6:07
going to call this particular value of
6:10
it
6:10
same way your dollar and whom so let us
6:15
check what this path contain so into any
6:18
variant of this year as this is an
6:20
environment variable you can get the
6:22
data outfit anywhere so you can check
6:24
I'm just calling this part and you are
6:26
going to get access to all the
6:29
particular you know path which we use
6:32
generally after we get login with this
6:35
particular user so this are the
6:38
directories these are the
6:39
of paths we can follow this particular
6:42
user can move and then get access to
6:44
your commands
6:45
so same VAP we also have dollar home
6:51
into capital case which is defined over
6:53
here so I need to check what this dollar
6:55
home contains so it contains your user's
6:59
home directory information right so when
7:02
the user get logins so it get access to
7:04
all this particular directory so I can
7:06
move into all the directories along with
7:08
that he will be able to move directly
7:10
into the bash so if you do not have this
7:12
command or if we do not declare this
7:15
your system your you know user want to
7:19
be able to get login directly into the
7:21
user profile so this is what the
7:23
environment you know variables we use
7:25
into the unite profile as well same way
7:30
we also have some files which we are
7:33
going to see that is your
7:39
Alice space - a which is your dot bash
7:44
history so dot bash history is generally
7:47
used to store your all the commands
7:50
which we have used using this particular
7:53
user so you can check into dot bash
7:56
history it will have the collection of
7:58
all the commands we have you know used
8:00
till now so I'll just give more so that
8:03
I can look at out completely so you can
8:06
see I started with PWD command and then
8:09
as the tutorial I have created I have
8:11
started using a different commands here
8:13
so it will keep a list of all my
8:16
commands which I have used using this
8:18
particular user
8:21
same way it also contains um no command
8:26
so that we can get all the particular
8:29
history pulled over here by using
8:31
history so I can see it will show you
8:33
along with the serial number right so
8:38
these are the commands which we have
8:39
used so now even it will collect the
8:43
history command which we have used right
8:47
so this is not how generally your
8:50
environment to variable speech and
8:52
really have and mostly if you want to
8:54
add any particular SDKs and you want to
8:56
define the path of those SDKs into your
9:00
environment variable you have to define
9:02
it into it so this is what exactly we
9:06
have into your environment variable and
9:08
dot profile contains and also we have a
9:13
file called as dot bash logout so once
9:17
we log out what should happen it
9:18
contains some scripts here you can come
9:21
to know while I move into the log out
9:25
file so you can find it contains a bash
9:30
logout come on that's it right so this
9:33
is how generally we create the
9:35
environment variables and we can check
9:37
which are the environment variables are
9:39
by default declared into the machine now
9:43
same way if I want to define any
9:45
environment variable of my own I can
9:47
also define it by using E and V and you
9:50
can define the name of our and moromete
9:52
variable so if suppose I want to define
9:55
the name as trainer
10:00
so you can see this one environment
10:03
variable is added and find the name
10:05
trainer has been added here so this is
10:08
how we had can declare your own
10:10
environment variables same way if I want
10:13
to define some pot
10:18
so I can also define the park in such a
10:21
way
10:21
et Cie slash
10:25
passwd as well so we it has by default
10:30
added into the path right so this is how
10:33
generally we can add you know the part
10:36
and then we can add the environment
10:38
variables into the system
#Computer Education
#Operating Systems
#Programming