Difference between revisions of "BOSS-Linux/C2/File-Attributes/English-timed"
PoojaMoolya (Talk | contribs) |
PoojaMoolya (Talk | contribs) |
||
Line 3: | Line 3: | ||
|'''Narration''' | |'''Narration''' | ||
|- | |- | ||
− | | 00: | + | | 00:01 |
| Welcome to this spoken tutorial on Linux File Attributes. | | Welcome to this spoken tutorial on Linux File Attributes. | ||
|- | |- | ||
| 00:05 | | 00:05 | ||
− | | The prerequisite for this tutorial is to create empty files named as example1, example2, example3, example4, example5, and testchown. | + | | The prerequisite for this tutorial is to create empty files named as ''' example1, example2, example3, example4, example5,''' and '''testchown.''' |
|- | |- | ||
|00:18 | |00:18 | ||
− | |Please create empty directories named as test_chown and directory1 also | + | |Please create empty directories named as '''test_chown''' and '''directory1''' also |
|- | |- | ||
| 00:25 | | 00:25 | ||
| A file attribute is metadata that describes or is associated with a computer file. | | A file attribute is metadata that describes or is associated with a computer file. | ||
|- | |- | ||
− | |00: | + | |00:34 |
|File attribute is the characteristics that describe a file, such as owner, file type, access permissions, etc. | |File attribute is the characteristics that describe a file, such as owner, file type, access permissions, etc. | ||
|- | |- | ||
− | | 00: | + | | 00:46 |
| c-h own command is used to change the ownership of the file or directory. This is an admin command, root user only can change the owner of a file or directory. | | c-h own command is used to change the ownership of the file or directory. This is an admin command, root user only can change the owner of a file or directory. | ||
|- | |- | ||
− | | 01: | + | | 01:01 |
− | | The syntax of chown command is ''' | + | | The syntax of chown command is '''chown space options space ownername space filename or directoryname ''' |
|- | |- | ||
| 01:13 | | 01:13 | ||
− | | We may give following options with chown command. | + | | We may give following options with '''chown''' command. |
|- | |- | ||
|01:18 | |01:18 | ||
Line 33: | Line 33: | ||
|'''-c ''': Change the permission for each file. | |'''-c ''': Change the permission for each file. | ||
|- | |- | ||
− | |01: | + | |01:32 |
|'''-f''' : Prevents ch own from displaying error messages. | |'''-f''' : Prevents ch own from displaying error messages. | ||
|- | |- | ||
Line 39: | Line 39: | ||
| Now we will look at some examples | | Now we will look at some examples | ||
|- | |- | ||
− | | 01: | + | | 01:41 |
− | | So go to the terminal. We will move to the directory where we have created empty files and folders. For that cd space Desktop slash file attribute and press enter | + | | So go to the terminal. We will move to the directory where we have created empty files and folders. For that '''cd space Desktop slash file attribute''' and press enter |
|- | |- | ||
| 01:56 | | 01:56 | ||
− | | Now type the command | + | | Now type the command '''ls space -l space testchown''' that is t-e-s-t-c-h-o-w-n and press Enter. |
− | + | ||
|- | |- | ||
| 02:11 | | 02:11 | ||
− | | Here we can see the owner of the file 'testchown' is shahid | + | | Here we can see the owner of the file '''testchown''' is '''shahid''' |
|- | |- | ||
| 02:18 | | 02:18 | ||
− | | To change the owner of the file, type the command | + | | To change the owner of the file, type the command '''sudo space c-h own space that is a-n-u-s-h-a anusha space testchown''' that is t-e-s-t-c-h-o-w-n. press Enter |
− | + | ||
− | press Enter | + | |
|- | |- | ||
| 02:36 | | 02:36 | ||
− | | Enter the sudo password and press Enter again. Press enter | + | | Enter the '''sudo''' password and press Enter again. Press enter |
|- | |- | ||
| 02:44 | | 02:44 | ||
− | | Now type | + | | Now type '''ls space -l space t-e-s-t-c-h-o-w-n''' and press Enter |
− | and press Enter | + | |
Here we can see the new owner of the file is anusha. | Here we can see the new owner of the file is anusha. | ||
|- | |- | ||
Line 66: | Line 63: | ||
|- | |- | ||
|03:07 | |03:07 | ||
− | |Type the command | + | |Type the command ''' ls space -l''' and press Enter |
− | Here we can see the owner of the directory 'test_chown' is shahid | + | Here we can see the owner of the directory '''test_chown''' is shahid |
|- | |- | ||
− | | 03: | + | | 03:22 |
| To change the owner of the directory, type the command | | To change the owner of the directory, type the command | ||
|- | |- | ||
|03:26 | |03:26 | ||
− | | | + | |'''sudo space chown space minus capital R space a-n-u-s-h-a anusha space test_chown''' which is directory name and press Enter |
− | and press Enter | + | |
|- | |- | ||
|03:44 | |03:44 | ||
|Enter the sudo password, if required and press Enter again. | |Enter the sudo password, if required and press Enter again. | ||
− | |||
+ | |- | ||
| 03:49 | | 03:49 | ||
− | | I will clear the screen by pressing Clt+L for our convenience. Now type | + | | I will clear the screen by pressing Clt+L for our convenience. Now type '''ls space -l''' press Enter |
Here we can see the new owner of the directory is anusha. | Here we can see the new owner of the directory is anusha. | ||
|- | |- | ||
| 04:06 | | 04:06 | ||
− | | chmod command is used to change the access mode or permissions of one or more files. | + | | '''chmod''' command is used to change the access mode or permissions of one or more files. |
|- | |- | ||
| 04:13 | | 04:13 | ||
− | | Syntax of the chmod command is | + | | Syntax of the '''chmod''' command is '''chmod space [options] space mode space filename space chmod space [options] space filename''' |
− | + | ||
We may give the following options with chmod command. | We may give the following options with chmod command. | ||
Line 97: | Line 92: | ||
|- | |- | ||
|04:34 | |04:34 | ||
− | | -f : Do not notify user of files that chmod cannot change. | + | | -f : Do not notify user of files that '''chmod''' cannot change. |
|- | |- | ||
| 04:41 | | 04:41 | ||
Line 103: | Line 98: | ||
|- | |- | ||
|04:44 | |04:44 | ||
− | |r | + | |r that is Read |
− | w | + | w that is Write |
− | x | + | x that is Execute |
− | s | + | s that is Set user (or group) ID |
|- | |- | ||
| 04:54 | | 04:54 | ||
Line 126: | Line 121: | ||
|- | |- | ||
| 05:20 | | 05:20 | ||
− | | Now we will look at some examples of chmod Move to terminal and enter the command to add execute-by-user permission to file example1. | + | | Now we will look at some examples of '''chmod'''. Move to terminal and enter the command to add execute-by-user permission to file '''example1.''' |
|- | |- | ||
|05:30 | |05:30 | ||
Line 132: | Line 127: | ||
|- | |- | ||
| 05:36 | | 05:36 | ||
− | | Now lets type | + | | Now lets type '''chmod space u+x space example1 ''' press Enter |
− | + | ||
− | press Enter | + | |
|- | |- | ||
− | + | | 05:49 | |
− | | Now type | + | | Now type '''ls space -l space example1 ''' |
press Enter to see the changes | press Enter to see the changes | ||
|- | |- | ||
|06:01 | |06:01 | ||
− | | | + | |Here you can see to assign the '''read/write/execute''' permission by owner, ''' read/execute''' permission by group, and execute-only permission by others to file '''example1''' |
|- | |- | ||
| 06:15 | | 06:15 | ||
− | | Now type the command | + | | Now type the command '''chmod space 751 space example1 ''' |
press Enter | press Enter | ||
|- | |- | ||
| 06:26 | | 06:26 | ||
− | | Now type | + | | Now type ''' ls space -l space example1 ''' and press Enter |
− | + | ||
− | and press Enter | + | |
|- | |- | ||
|06:35 | |06:35 | ||
− | |Here we can see that above command has assigned the read/write/execute permission by owner, read/execute permission by group, and execute-only permission by others to file example1. | + | |Here we can see that above command has assigned the '''read/write/execute''' permission by owner, '''read/execute''' permission by group, and execute-only permission by others to file example1. |
|- | |- | ||
| 06:52 | | 06:52 | ||
− | | To assign read-only permission to file example1 for everyone type the command | + | | To assign read-only permission to file '''example1''' for everyone type the command ''' chmod space =r space example1 ''' |
and press Enter | and press Enter | ||
|- | |- | ||
| 07:08 | | 07:08 | ||
− | | Now type the command | + | | Now type the command '''ls space -l space example1''' |
press Enter | press Enter | ||
|- | |- | ||
|07:19 | |07:19 | ||
− | |Here we can see that the read only permission has been assigned to file example1 for everyone | + | |Here we can see that the '''read only''' permission has been assigned to file '''example1''' for everyone |
|- | |- | ||
| 07:30 | | 07:30 | ||
− | | To change the permission recursively and assign the read and execute access for everyone and also write access for the owner of the directory directory1 type the command | + | | To change the permission recursively and assign the read and execute access for everyone and also write access for the owner of the directory '''directory1''' type the command |
|- | |- | ||
|7:44 | |7:44 | ||
− | | | + | |'''chmod space minus capital R space 755 space directory1 ''' |
press Enter | press Enter | ||
|- | |- | ||
| 08:00 | | 08:00 | ||
− | | Now type | + | | Now type ''' ls space -l ''' press Enter to see the changes |
− | + | ||
− | press Enter to see the changes | + | |
|- | |- | ||
| 08:09 | | 08:09 | ||
− | | To give the user execute permission on file example2 Type the command | + | | To give the user execute permission on file '''example2''' Type the command |
− | + | ''' chmod space u+x space example2 ''' press Enter | |
− | press Enter | + | |
|- | |- | ||
| 08:27 | | 08:27 | ||
− | | Now type the command | + | | Now type the command ''' ls space -l space example2 ''' and press Enter |
− | + | ||
− | and press Enter | + | |
|- | |- | ||
|08:40 | |08:40 | ||
− | |Here we can see that execute permission has been assigned to user on example2 | + | |Here we can see that execute permission has been assigned to user on '''example2''' |
|- | |- | ||
| 08:50 | | 08:50 | ||
− | | To add the write permissions to the group for file example3 | + | | To add the write permissions to the group for file '''example3''', type the command |
− | type the command | + | '''chmod space g+w space example3'''. Press Enter |
− | + | ||
− | + | ||
|- | |- | ||
| 09:10 | | 09:10 | ||
− | | and now type | + | | and now type ''' ls space -l space example3 ''' press Enter |
− | + | ||
− | press Enter | + | |
|- | |- | ||
− | |09: | + | |09:24 |
|Here we can see the write permission has been added to group | |Here we can see the write permission has been added to group | ||
|- | |- | ||
| 09:30 | | 09:30 | ||
− | | To remove the write permissions for all type the command | + | | To remove the write permissions for all type the command ''' chmod space a-w space example3 ''' |
− | + | ||
press Enter | press Enter | ||
|- | |- | ||
| 09:45 | | 09:45 | ||
− | | Now type | + | | Now type ''' ls space -l space example3 ''' press Enter |
− | + | ||
− | press Enter | + | |
|- | |- | ||
|09:55 | |09:55 | ||
Line 221: | Line 201: | ||
|- | |- | ||
| 10:02 | | 10:02 | ||
− | | chgrp command is used to change the group of one or more files to newgroup. | + | | '''chgrp''' command is used to change the group of one or more files to newgroup. |
|- | |- | ||
|10:10 | |10:10 | ||
− | |Newgroup is either a group ID number or a group name located in /etc/group. | + | |Newgroup is either a group ID number or a group name located in '''/etc/group. ''' |
|- | |- | ||
|10:20 | |10:20 | ||
Line 230: | Line 210: | ||
|- | |- | ||
| 10:26 | | 10:26 | ||
− | | The syntax for the chgrp command is | + | | The syntax for the chgrp command is '''chgrp space [options] space newgroup space files.''' |
− | + | ||
|- | |- | ||
| 10:36 | | 10:36 | ||
− | | Lets go to terminal. Now we will look at some examples of chgrp command. | + | | Lets go to terminal. Now we will look at some examples of '''chgrp''' command. |
− | type the command | + | type the command '''ls space -l space example4''' press Enter |
− | press Enter | + | |
|- | |- | ||
|10:57 | |10:57 | ||
− | |Here we can see the group permission is for user shahid | + | |Here we can see the group permission is for user '''shahid ''' |
|- | |- | ||
| 11:03 | | 11:03 | ||
− | | To change the group permission , type the command | + | | To change the group permission , type the command '''sudo space chgrp space rohit space example4''' |
|- | |- | ||
|11:20 | |11:20 | ||
− | |press Enter | + | |press Enter. Enter the sudo password if required. |
− | Enter the sudo password if required. | + | |
|- | |- | ||
| 11:27 | | 11:27 | ||
− | | Now type the command | + | | Now type the command ''' ls space -l space example4 ''' |
press Enter | press Enter | ||
|- | |- | ||
Line 265: | Line 242: | ||
|- | |- | ||
|12:00 | |12:00 | ||
− | |Whenever a program refers to a file by name, the system actually uses the filename to search for the corresponding inode. | + | |Whenever a program refers to a file by name, the system actually uses the filename to search for the corresponding '''inode. ''' |
|- | |- | ||
| 12:12 | | 12:12 | ||
− | | We can use ls space -i command to see the inode number of a file. | + | | We can use ''' ls space -i''' command to see the '''inode''' number of a file. |
|- | |- | ||
|12:19 | |12:19 | ||
− | |type the command | + | |type the command ''' ls space -i space example5 ''' press Enter |
− | press Enter | + | |
|- | |- | ||
|12:29 | |12:29 | ||
Line 281: | Line 257: | ||
|- | |- | ||
|12:41 | |12:41 | ||
− | |Hard links are to associate multiple directory entries with a single inode. | + | |Hard links are to associate multiple directory entries with a single '''inode.''' |
− | ln is the command to make link | + | '''ln''' is the command to make link |
|- | |- | ||
| 12:52 | | 12:52 | ||
− | | The syntax of ln command to create the hard link is | + | | The syntax of '''ln''' command to create the hard link is |
|- | |- | ||
|12:57 | |12:57 | ||
− | |ln space source space link | + | |'''ln space source space link ''' where, '''source''' is an existing file and '''link''' is the file to create. |
|- | |- | ||
| 13:06 | | 13:06 | ||
Line 294: | Line 270: | ||
|- | |- | ||
|13:10 | |13:10 | ||
− | |Let me clear the screen again. Now type the command | + | |Let me clear the screen again. Now type the command '''ln space example1 space exampleln''' press Enter |
− | + | ||
|- | |- | ||
| 13:25 | | 13:25 | ||
− | | To display the inode number of both the files, type the command | + | | To display the '''inode''' number of both the files, type the command |
− | + | '''ls space -i space example1 space exampleln '''press Enter | |
− | press Enter | + | |
|- | |- | ||
|13:41 | |13:41 | ||
Line 310: | Line 284: | ||
|- | |- | ||
| 14:07 | | 14:07 | ||
− | | The syntax of ln command to create soft links is | + | | The syntax of '''ln''' command to create soft links is |
|- | |- | ||
|14:12 | |14:12 | ||
− | |ln space -s space {target-filename} space {symbolic-filename} | + | |''' ln space -s space {target-filename} space {symbolic-filename} ''' |
|- | |- | ||
| 14:19 | | 14:19 | ||
Line 319: | Line 293: | ||
|- | |- | ||
| 14:25 | | 14:25 | ||
− | | To create the soft link, type the command | + | | To create the soft link, type the command '''ln space -s space example1 space examplesoft ''' |
− | + | ||
|- | |- | ||
|14:40 | |14:40 | ||
Line 326: | Line 299: | ||
|- | |- | ||
| 14:43 | | 14:43 | ||
− | | Now, to display the inode number and list of both the files, type the command | + | | Now, to display the '''inode''' number and list of both the files, type the command |
− | + | ''' ls space -li space example1 space examplesoft ''' | |
|- | |- | ||
|15:01 | |15:01 | ||
Line 333: | Line 306: | ||
|- | |- | ||
|15:03 | |15:03 | ||
− | |Here we can see that inode number of both the files are different and examplesoft is a softlink of example1. | + | |Here we can see that '''inode''' number of both the files are different and examplesoft is a softlink of example1. |
|- | |- | ||
| 15:16 | | 15:16 | ||
Line 351: | Line 324: | ||
|- | |- | ||
|15:50 | |15:50 | ||
− | | This script | + | | This script is contributed by Anusha Ambala and Shahid. Thanks or joining. |
|} | |} |
Revision as of 14:06, 4 December 2014
Time | Narration |
00:01 | Welcome to this spoken tutorial on Linux File Attributes. |
00:05 | The prerequisite for this tutorial is to create empty files named as example1, example2, example3, example4, example5, and testchown. |
00:18 | Please create empty directories named as test_chown and directory1 also |
00:25 | A file attribute is metadata that describes or is associated with a computer file. |
00:34 | File attribute is the characteristics that describe a file, such as owner, file type, access permissions, etc. |
00:46 | c-h own command is used to change the ownership of the file or directory. This is an admin command, root user only can change the owner of a file or directory. |
01:01 | The syntax of chown command is chown space options space ownername space filename or directoryname |
01:13 | We may give following options with chown command. |
01:18 | -R : To change the permission on files that are in the subdirectories of the directory that you are currently in. |
01:28 | -c : Change the permission for each file. |
01:32 | -f : Prevents ch own from displaying error messages. |
01:37 | Now we will look at some examples |
01:41 | So go to the terminal. We will move to the directory where we have created empty files and folders. For that cd space Desktop slash file attribute and press enter |
01:56 | Now type the command ls space -l space testchown that is t-e-s-t-c-h-o-w-n and press Enter. |
02:11 | Here we can see the owner of the file testchown is shahid |
02:18 | To change the owner of the file, type the command sudo space c-h own space that is a-n-u-s-h-a anusha space testchown that is t-e-s-t-c-h-o-w-n. press Enter |
02:36 | Enter the sudo password and press Enter again. Press enter |
02:44 | Now type ls space -l space t-e-s-t-c-h-o-w-n and press Enter
Here we can see the new owner of the file is anusha. |
03:03 | Now we will see how to change owner of the directory |
03:07 | Type the command ls space -l and press Enter
Here we can see the owner of the directory test_chown is shahid |
03:22 | To change the owner of the directory, type the command |
03:26 | sudo space chown space minus capital R space a-n-u-s-h-a anusha space test_chown which is directory name and press Enter |
03:44 | Enter the sudo password, if required and press Enter again. |
03:49 | I will clear the screen by pressing Clt+L for our convenience. Now type ls space -l press Enter
Here we can see the new owner of the directory is anusha. |
04:06 | chmod command is used to change the access mode or permissions of one or more files. |
04:13 | Syntax of the chmod command is chmod space [options] space mode space filename space chmod space [options] space filename
We may give the following options with chmod command. |
04:29 | -c : Print information about files that are changed. |
04:34 | -f : Do not notify user of files that chmod cannot change. |
04:41 | There are following types of access or permissions |
04:44 | r that is Read
w that is Write x that is Execute s that is Set user (or group) ID |
04:54 | Alternatively, we may specify permissions by a three-digit octal number. |
05:00 | The first digit stands for owner permission, the second stands for group permission, and the third stands for other's permission. |
05:09 | Permissions are calculated by adding the following octal values:
4 that is Read 2 that is Write 1 that is Execute |
05:20 | Now we will look at some examples of chmod. Move to terminal and enter the command to add execute-by-user permission to file example1. |
05:30 | Before that i will again clear the screen by pressing Clt+l. |
05:36 | Now lets type chmod space u+x space example1 press Enter |
05:49 | Now type ls space -l space example1
press Enter to see the changes |
06:01 | Here you can see to assign the read/write/execute permission by owner, read/execute permission by group, and execute-only permission by others to file example1 |
06:15 | Now type the command chmod space 751 space example1
press Enter |
06:26 | Now type ls space -l space example1 and press Enter |
06:35 | Here we can see that above command has assigned the read/write/execute permission by owner, read/execute permission by group, and execute-only permission by others to file example1. |
06:52 | To assign read-only permission to file example1 for everyone type the command chmod space =r space example1
and press Enter |
07:08 | Now type the command ls space -l space example1
press Enter |
07:19 | Here we can see that the read only permission has been assigned to file example1 for everyone |
07:30 | To change the permission recursively and assign the read and execute access for everyone and also write access for the owner of the directory directory1 type the command |
7:44 | chmod space minus capital R space 755 space directory1
press Enter |
08:00 | Now type ls space -l press Enter to see the changes
|
08:09 | To give the user execute permission on file example2 Type the command
chmod space u+x space example2 press Enter |
08:27 | Now type the command ls space -l space example2 and press Enter |
08:40 | Here we can see that execute permission has been assigned to user on example2 |
08:50 | To add the write permissions to the group for file example3, type the command
chmod space g+w space example3. Press Enter |
09:10 | and now type ls space -l space example3 press Enter |
09:24 | Here we can see the write permission has been added to group |
09:30 | To remove the write permissions for all type the command chmod space a-w space example3
press Enter |
09:45 | Now type ls space -l space example3 press Enter |
09:55 | Here we can see the write permission for all has been removed |
10:02 | chgrp command is used to change the group of one or more files to newgroup. |
10:10 | Newgroup is either a group ID number or a group name located in /etc/group. |
10:20 | Only the owner of a file or a privileged user may change the group. |
10:26 | The syntax for the chgrp command is chgrp space [options] space newgroup space files. |
10:36 | Lets go to terminal. Now we will look at some examples of chgrp command.
type the command ls space -l space example4 press Enter |
10:57 | Here we can see the group permission is for user shahid |
11:03 | To change the group permission , type the command sudo space chgrp space rohit space example4 |
11:20 | press Enter. Enter the sudo password if required. |
11:27 | Now type the command ls space -l space example4
press Enter |
11:38 | Here we can see that the group has changed from shahid to rohit. |
11:46 | The inode number is a unique integer assigned to the device. |
11:51 | Inode stores basic information about a regular file or a directory. |
11:57 | All the files are hard links to inodes. |
12:00 | Whenever a program refers to a file by name, the system actually uses the filename to search for the corresponding inode. |
12:12 | We can use ls space -i command to see the inode number of a file. |
12:19 | type the command ls space -i space example5 press Enter |
12:29 | Number written before the file is the inode number of the file. |
12:35 | Inodes are associated with precisely one directory at a time. |
12:41 | Hard links are to associate multiple directory entries with a single inode.
ln is the command to make link |
12:52 | The syntax of ln command to create the hard link is |
12:57 | ln space source space link where, source is an existing file and link is the file to create. |
13:06 | Now we will look at some examples of hard links |
13:10 | Let me clear the screen again. Now type the command ln space example1 space exampleln press Enter |
13:25 | To display the inode number of both the files, type the command
ls space -i space example1 space exampleln press Enter |
13:41 | Here we can see that inode number of both the files are same, file exampleln is the hard link for file example1 |
13:54 | Soft link symbolic link is a special type of file that contains a reference to another file or directory in the form of an absolute or relative path. |
14:07 | The syntax of ln command to create soft links is |
14:12 | ln space -s space {target-filename} space {symbolic-filename} |
14:19 | Now we will look at some examples of soft link |
14:25 | To create the soft link, type the command ln space -s space example1 space examplesoft |
14:40 | press Enter |
14:43 | Now, to display the inode number and list of both the files, type the command
ls space -li space example1 space examplesoft |
15:01 | press Enter |
15:03 | Here we can see that inode number of both the files are different and examplesoft is a softlink of example1. |
15:16 | So in this tutorial we have learnt about the Linux Files Attributes like changing permission, ownership and group of a file. |
15:26 | We also learnt about the inode, soft and hard links of a file. |
15:31 | This brings me to the end of this tutorial. |
15:35 | Spoken Tutorials are a part of the Talk to a Teacher project, supported by the National Mission on Education through ICT. |
15:44 | More information on the same is available at the following link. |
15:50 | This script is contributed by Anusha Ambala and Shahid. Thanks or joining. |