We have just discussed what is the difference between absolute path and relative path in Linux?
And you know, that Slash is simply a root directory in Linux computer.
Also, you know that when a user logs into Linux shell either locally or remotely, he or she logs basically
into home directory and by default you will see this tilde sign in command prompt and if you enter w
you could find location of your home directory and location of home directory for this root user is
simply slash root.
It is absolute path.
All right, now let me go to root directory by typing CD and slash and you see that the command prompt
was changed and let me use here command ls that will list all directories and files inside of the root
folder.
Let's press enter and here you'll see some directories and files.
And please notice that those names have different colors and if for some name doesn't have any color,
it means that it is a regular file like hello dot txt.
I have created this file in one of the previous lectures.
Same relates to this file and this file directories are colored in blue color like proc run, serve
and cis and in light blue color like Lipa or sbin Linux colors Linux.
And there are two types of Linux soft links and hard Linux.
I'll explain what is link a bit later.
If you want to see the details about every directory or file, you could add additional option ls l.
And with this option you'll see actually a table that contains a bunch of additional information in
this table.
First, you see permissions.
Here is permission, here is permission and so on.
Next you see quantity of links to specific directory or file.
Next comes username, next group name afterwards size in bytes.
For example, here you see size.
That is 4096 bytes around four kilobytes.
Next date when directory of file was created or modified.
And finally, name and colours in this output are the same as you see when you don't use this option.
And please notice that for Linux that are colored using light blue color like this one or this one,
you'll see actual link and it means that for example lib 64 simply points to another directory user
lib 64 and the lib points to user slash lib.
All right, let me now explain you in details what those permissions here mean.
First, let's have a look at first character d l or dash if it is a file like hello dot txt or std r
dot txt then first character will be simply dash.
Here you see dash here you see dash and here you see also same sign.
Next for directories.
First character will be d like in this example home directory or in this example media directory and
so on.
And Linux will start with L character like in this example, this one or this one.
Next, you see permissions for a specific file or directory, and they are grouped into three different
groups.
Here is the first group.
Here is the second group, and here is the third group.
Those are permissions for user read, write and execute.
Next come permissions for group.
Group is in second column and if a user wasn't assigned to a specific group, then group name will be
the same as username.
That's what we see here.
Read, write and execute for group users and read, write and execute for all other users that don't
belong to this specific group.
For example, let's have a look at this line.
In this case, user root user is able to read, write and execute this directory.
Opt.
Group users are able only to read this directory.
They are not able to write, but they are able to execute.
And same for all remaining users.
They are able to read, not able to write and are able to execute.
If I have a look at this line, it is actually root directory that is a home directory for root user.
Here I see that this directory could be read, written and executed only by user.
There are no permissions for other users in the same group or for other users from other groups here.
Everywhere you see dashes.
Let's have a look at those permissions for this std error dot txt file.
It is a file.
It starts with the dash.
Next here you see user permissions read, write and not execute.
Are the users in the same group are able only to read this file?
They are not able to change it or execute and remaining users in other groups are also able only to
read this file.
I'll explain you how to make file executable a bit later when I'll tell you how to create your own shell
scripts.
And if you want to execute a specific shell script, you need to make such file executable.
You need to change its permissions.
We will get back to it a bit later.
All right.
That's all for file permissions and that's how you are able to distinguish between directories, links
and files.
All right.
Next, let me explain you how you could see file size of every directory or file in human readable format.
For that, you could use another option.
Let's type ls l h h stands for human.
Let's press enter.
And now I see those sizes in kilobytes, megabytes and so on.
Actually, in this case I see only sizes in kilobytes.
But let me for example go into bin folder and enter same command there.
CD bin and ls l h.
And now I see some sizes in kilobytes.
56kB.
35kB.
Probably there are some larger files.
Let me go a bit up.
Yeah.
Here is an example of such file.
This file is 3.4MB in size.
Also a bit later I'll explain you how you could filter files by file size and how you could sort files
in this output.
Also, I want to show you how to use one more option.
Let me clear terminal and go back to root directory.
And here let me type LS dash capital F With this option you'll see actually types of all files and directories.
And this ad means that it is a link.
This forward slash means that here you see directory and if you don't have any forward slash or ad at
the end of the name, then it means that it is simply a regular file like hello dot txt.
This output is useful when you want to write this output, for example, to a specific file and inside
of the file you will not see any colors like blue color, light blue and so on.
Let me show you that quickly.
For example, I could write this output into specific file.
Let's say test dot txt.
And if I'll read the contents of this file called Test.txt, I'll see actually the same characters at
the end of every name.
But of course, I don't see any colors because the text files store characters simply in C or other
format.
They don't store any colors at all.
All right.
Let me clear our terminal.
And now let me show you another option.
Dash LA with a option.
You could also see hidden files and folders.
And for example, here is hidden file, hidden files and folders in Linux.
Start always with dot.
If I simply enter ls l.
I don't see this file here in this output, but with a option.
I see such files and folders on the list.
In this case there is a single hidden file.
If I go to etsy folder and list all files and folders including hidden files and folders here, scroll
up.
And at the beginning of this output I see.
Hidden file dot p.w.d. dot log.
Again, without this option you will not see hidden directories and files.
All right.
That's all what I wanted to demonstrate you here in this lecture.
And now you know how to distinguish between directories, files and links.
They have different colors, at least in Bash Shell.
Also, you know how to use such options as L A and H.
With H option, you could find human readable sizes for all directories and files you are looking at.
That's all for this lecture.
And next, let me explain you how to create new files and folders.
I'll see you next.
Bye bye.