Hello and welcome!
In this video session we will discuss the files and its operation in Linux system.
A file has three types of permission read, write, and executable.
Read has a value for write, has a value two and executable has a value one.
Every file has a ownership, a user, a group, and others.
The creator of the file is user.
Group is a group of different users, and others are those who are neither user nor belong to any group.
Each owner can have different set of permissions on a file.
The different types of files in Linux systems are regular file represented by dash.
D stands for directory.
C stands for character device file.
B stands for block.
Device, S is a socket file, P is a name file, and L represents a symbolic link
For example.
LS minus L is a command which gives the contents of the directory.
Here there are three files present in this folder.
The regular files are represented by dash, and each file has a owner specified by this column, and
the group is specified by this column.
So when a owner creates a file, the owner has a specific set of permissions.
In this case, the owner of this file has read write executable permission and the group has read write
executable and others have no permission.
So each character represents the permission.
So first character represents a read permission, the second character represents the write permission,
and the third character represents the executable permission of the user then next set of permission
read write executable or for group and next set of permission read write executable or for others.
So whenever there is a dash, that means that particular owner does not have that particular permission.
For example, in this case the owner has only read and write and no executable permission is present
and the group has read write permissions without the executable permission and others have only read
permission.
Write and executable permissions are not present.
Now let us see how to change the permission of a given file.
So mod is the command used to change the permission of a file.
Now let us say we have to change the permission of this file.
Let's change the permission to all access for this file.
So seven represents read write executable for the user.
The next seven represents read write executable permission for the group and next seven represents read
write executable permission for others.
So we have changed the permission.
Now let's see the permission whether it has changed by this command.
So here we can see we had changed the permission of this file to 777 means the first seven represents
read write executable permission for user.
The next seven represents read write executable permission for group and next seven represents read
write executable permission for others.
Now let's change the permission to
770.
That means.
The user has read write executable permission, which represents the first seven.
The second seven represents the group has read, write, execute permission and now zero represents
the others does not have any other permission.
Similarly.
Now let's consider some other combinations.
Six represents read and write.
Seven represents a read write executable.
So here we have given six for the user permission.
That means read has a value for write has a value of two.
So read plus write is six here.
And read write executable is four plus two plus one.
It is seven which is represented by seven and others does not have any permissions, which is represented
by zero.