[No audio]
Filesystem color definition. Hello everyone, and this is the
lecture where I am going to cover how each file
or directory changes its color in Linux environment. When you run
ls -ltr or ls -l or any
other option that will give you the listing of files
and directories you'll notice that each file or directory. Or
link they are showing up in different colors. So what
really those color mean, and how are they identified in
Linux environment?
This is a screenshot I have that I captured from my
Linux machine and if you look at this screenshot you'll see
this all the way to the right there is these different
files with different colors. There's this yellow file.
There's blue of them, and there's green of them. In this
lecture this is what we exactly I'm going to cover why
there are different colors and what is the representation of each
color in Linux environment. So let's go into our next slide
and we'll cover the first one. Very first one is the
blue. blue, every time you do ls -l, and you
see any name that shows in blue color it means it's
a directory. Anything that shows up in green it's an executable
recognized data file, meaning it has a bash shell scripting in
it, and it is actual a script which has the executable
permissions assigned to it. So it may be possible the script
does not have the shell defined in it but the executable
permission assigned to the file will make that file color green.
Then sky blue color which is a symbolic link file. When
you create a link from your home directory,
let's say to another location and then you go to
that other location, you will see the linked file would
show up in sky blue color. As an example,
if you wanted to create a link you will run
this command which is cd /home/iafzal, this is where the source
of the file is located. You create a file,
let's say touch ca, in my example
let's say Captain America, then you go to cd into /tmp,
that's where you want the link to be created and then
you run the command ln -s symbolic link to /home/iafzal/ca,
which is Captain America. By the way I apologize I missed
the slash right after home but anyway.
We will cover all these steps and I will show you
exactly when we create a link how it shows up in
a different color. Moving on and then we have yellow color
files, yellow with the black background. What are those?
Those are the actual device files that are usually found
under /dev. Anything that is attached to your system for example,
mouse, keyboard, or speakers, or anything that has like a
scsi devices, or IDE devices they show up in /dev
filesystem and they will show up as yellow color.
Then we have a pink color files, those are graphic
image files like JPEG or any type of graphical that
has graphic, and of course you cannot cat that file,
you have to have a certain program to view that image,
and you could only view an image if you are
logged into your system through GUI, through the GUI desktop.
You cannot view a graphical image file
in PuTTY session or SSH session.
Next we have the red files.
Red files are the archive files.
When we have two or three files together and we put
them in a tar file, by running the command tar,
so that container is called an archive file, and
those archive files are shown in a red color.
Then we have red with black is a broken
As it's showing right now, it is a broken link, which
means if you create a symbolic link and that symbolic link
is created with incorrect procedure or incorrect way of running commands,
then it will show up, instead of sky blue color it
will show up red with black background.
So as an example, you will go into
the /home/iafzal directory, you create a file,
let's say touch ihulk, meaning Incredible Hulk.
Then you run the command ln -s for symbolic link,
ihulk /tmp/ihulk.
Now once you run this command it will
show up in red with black background. Why?
Because in the command ln -s, we are not
using the absolute path for the source file.
We have to specify ln -s
/home/iafzal/ihulk, and then the destination,
then it would become sky blue.
Anyway, that's an example of you showing if you have
a broken link it will show up in red and
you could tell right away that link is created but
it's not going to work because it's broken.
It does not have the actual source of the file.
So these are the few lists, a few
colors, there might be more different colors and
you could also modify these colors depending on
what color is your preferred method.
But I would say let's not change any
colors in the Linux environment because this way
you're going to have a problem and you are gonna
jump around from one environment to another.
And please do remember again, as I said before,
not every Linux environment would have the exact same
colors or even have any colors of any kind.
So let's log into my Linux machine and
I have already logged into my Linux machine here,
and I have logged in with my PuTTY session.
So the first thing we will go over is
the directory. I am logged in as myself.
I am in my home directory and when I do ls -ltr,
you will see anything that is a directory is blue
coded color, and you could verify it by looking at this,
the first column and the first bit is
d that shows that it's a directory.
Then we have a color green.
If you notice we have a file called homer
and it has this executable permission xx and x.
As soon as you assign xxx or
executable this becomes like a script.
Linux operating system treats it as a shell
script and changes its color to green.
If I were to change it back
or remove executable permission with a for
for all minus executable homer.
And now if I do ls -ltr, you will
see the homer right here is no more green because
we have removed xx and x from everyone.
So that's why, and that's,
that's a way to identify if the color is green
or not or if it's a script or not.
Next one we have a sky blue
color and that is for creating links.
So I'm going to make this little
smaller so I could read the example there.
So if I go to my home directory, which I'm already
in /home/iafzal, and I create a file called touch ca meaning
Captain America, I will do ls -ltr, and I'll verify it.
Let me make this a little smaller and make this bigger
this way, so this way you could read it better.
Okay, so I have verified that I've created
a file Captain America and it's white color.
Of course it's a regular file.
Now if I go into tmp directry and I create
a link to that Captain America file by typing
ln -s as symbolic link to /home/iafzal/ca,
hit enter, I could verify it while I'm
in tmp directory, I could run ls -ltr, again
ltr will show me the listing in the time when
they were created or modified and in reverse order meaning
the latest one will be at the bottom.
So I'll hit Enter, and you will see the last one,
the bottom one is right here where I have
ca is linked to this actual source file and
you see it's the sky blue color.
Okay then the next one we have is yellow
with black background and those are the device files.
And the device files are located in /dev directory.
So when I am in /dev directory,
let me clear the screen.
So I am in /dev directory and when I do ls -l or ltr,
and hit Enter, you will see all those
files that shows up here are in yellow color.
And as you can see tty
are the terminals, and there are keyboards.
There are many other things that you could look into.
The network cards, network adapters, all
those are the actual devices.
And remember, every time you see a device, the bit
that is assigned to a device starts with C.
And anything that does not have any assigned bit
there, it means it's just a regular file.
And anything that has d in it is what, exactly,
it's a directory.
So now we know that the
device files colors are in yellow. Perfect.
Now let's go to our pink.
Now for pink I do not have any file
in my system that is an image file.
So I have to download an image file to
actually show you how the color looks like.
So first let me go to my home directory,
/home/iafzal, clear the screen.
And now I need to first download.
How do I download?
There is a command I would use, wget that
I would use to download an image from the Internet.
So for right now, what wget does is actually it
gets anything that we specify as in a URL after wget.
So wget, I'm telling you, to get a
file from a URL. Where is that URL?
For the URL, I have to go in to
[No audio]
like Google, and I will type in, let's say
colors, color, anything that you want to type.
Go to Images file.
And let's say this is the
image I want to download balloons,
for example. I would do a right click on
it, and I will say, Copy Image Location.
This is going to copy exactly
where the image is located.
I'll go back to my PuTTY session, and here
I will right click and I have specified the
exact link where that file is located.
And now I will hit enter.
Okay, it is saying that it is giving
me a broken syntax error near unexpected token.
So there is not something right.
But anyway, I'll go ahead and
I will download a different image, how about this one.
I will Copy Image Location.
I think it is the location.
[No audio]
I will run the wget command again and hit Enter.
Okay, so now this time it worked. I don't know.
The image location for the other file was
probably somewhere or has a broken link somewhere.
Anyway, my point is to actually show you how you
could have an image file and download an image file.
We downloaded this image file called img_colarmap.gif,
and it is downloaded in my home directory.
Because when I ran the wget command, it
actually downloaded in the current or existing directory.
So now when I do ls -ltr,
that image file will show up in pink.
[No audio]
Okay, so I did ls -ltr.
Maybe it's showing up as an older file.
That's why it's showing up all the way up there.
Okay, so that's the file, because it's
somehow showing up on January 26, 2016.
So that's not the time when we downloaded it.
Maybe that's the time and it was created
by the author, whoever put it in there.
So anyway, if I do ls -l,
then you will see that in the middle.
So now it's showing up in pink color.
If I do cat on it, I cannot view the image file.
I have shown how to view an
image file in my later sections,
in the additional resources section, you can
go back and check it out.
The next one is the archive file, the tar file.
So if I have a list of files, for example,
right here I have a file ca or Captain America.
I have a file, james. I have a file
peter or instead of just that, I want
you to create files called a b c d.
You could create all those files in one shot
and hit Enter and do ls -ltr.
And you will see your files are created
as it is showing up right here.
Now, I wanted to put all
these four files in a container.
So I will use a command tar cvf, so tar cvf is
the option to put the files into that container.
Before we put the file in the container, we
have to give the name to that container.
So we will say, for example, all.tar.
And now what are we going to put into this container?
We want to put in file a b c and d
So now it'll go in.
So it's actually not actually removing it
and putting it into a container.
It's actually copying it and putting into a container.
So the source file still stays there, but
the container has a copy of those.
So if I do ls -ltr now, and now
you will see the source files are still there, but
the container file is shown as all the red.
And that's what's called the archive files.
My purpose is to show you the red and how it shows
up on the Linux filesystem when you run ls -ltr.
All right, so the last one I have is a
red with black background and that is for broken links.
So if I create a file in my home directory, so if
I go to my home directory, /home/iafzal, which I'm
already in, and I create a file called incredible hulk.
ihulk do ls -ltr and you'll
see it's all the way at the bottom. Perfect.
Now, if I create a link ln -s ihulk,
and I want it
to be linked on /tmp/ihulk, and hit Enter.
Now when I go to tmp directory and I do ls -ltr,
you will see ihulk, there is a link and it
is linked to a file called ihulk, but it is broken
and that is why it is showing up in the red color.
[No audio]
So that's the one.
The red color is showing up.
If I have to fix this, I have to specify
the absolute path, meaning I ran this command, and instead
of this command, I would have to run /home/iafzal/hulk,
and when I run this command,
it says too many symbolic link. I understand.
First I have to remove that, remove ihulk.
And now if I run this command now, it will work.
Now if I do ls -ltr, you
see, ihulk is in blue color.
So source file has to be specified as an absolute path.
Now, you notice I have two of them,
red with black background showing up as broken
link and just red with archive.
And you probably notice, hey,
aren't they both the same?
No, because if I had the white background right now,
by default my PuTTY screen has a black background so
if I had a white background then you would have
seen red as just red and the black meaning on
the white screen the broken link would show as black
background on that little text and would have text would would
have itself a red on it.
All right, so anyway, this is the
topic of filesystem and color definition. Good luck.
[No audio]