Difference between revisions of "BOSS-Linux/C2/File-System/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 7: Line 7:
 
|-
 
|-
 
| 00:04
 
| 00:04
|I am using Ubuntu 10.04.  
+
|I am using Linux Operating system.
 
|-
 
|-
| 00:07
+
| 00:08
 
|We assume that you know how to get started with the Linux operating system and have some basic idea about commands.  
 
|We assume that you know how to get started with the Linux operating system and have some basic idea about commands.  
 
|-
 
|-
| 00:13
+
| 00:16
 
|If you are interested, it is available through another spoken tutorial, on the following website http://spoken-tutorial.org
 
|If you are interested, it is available through another spoken tutorial, on the following website http://spoken-tutorial.org
 
|-
 
|-
| 00:25
+
| 00:28
 
|Also note that linux is case sensitive.
 
|Also note that linux is case sensitive.
 
|-
 
|-
| 00:28
+
| 00:32
 
| All the commands used in this tutorial are in lower case unless otherwise mentioned.  
 
| All the commands used in this tutorial are in lower case unless otherwise mentioned.  
 
|-
 
|-
| 00:36
+
| 00:41
 
|In Linux almost everything is a file.  
 
|In Linux almost everything is a file.  
 
|-
 
|-
| 00:39
+
| 00:44
 
|So what is a file? In real life we know that a file is where we store our documents and papers.  
 
|So what is a file? In real life we know that a file is where we store our documents and papers.  
 
|-
 
|-
| 00:47
+
| 00:54
 
|Similarly in Linux a file is a container for storing information.  
 
|Similarly in Linux a file is a container for storing information.  
 
|-
 
|-
| 00:53
+
| 01:00
 
|Next what is a directory?  
 
|Next what is a directory?  
 
|-
 
|-
| 00:56
+
| 01:03
 
|A directory can be understood as a collection of files and other (sub)directories.
 
|A directory can be understood as a collection of files and other (sub)directories.
 
|-
 
|-
| 01:02
+
| 01:10
 
|A directory helps us in organising our files in a systematic manner.  
 
|A directory helps us in organising our files in a systematic manner.  
 
|-
 
|-
| 01:08
+
| 01:16
 
|This is like what we call folders in Windows.
 
|This is like what we call folders in Windows.
 
|-
 
|-
| 01:12
+
| 01:20
 
| It allows different users to have their own directories with their files which others cannot access or modify.  
 
| It allows different users to have their own directories with their files which others cannot access or modify.  
 
|-
 
|-
| 01:20
+
| 01:30
 
|Also if there are no directories, all the files on the system need to have unique names,which would be very difficult to maintain.
 
|Also if there are no directories, all the files on the system need to have unique names,which would be very difficult to maintain.
 
|-
 
|-
| 01:31
+
| 01:41
|Though these definitions of files and directories are good to get a general feel about them, they are not entirely accurate.  
+
|These definitions of files and directories are good to get a general feel about them, they are not entirely accurate.  
 
|-
 
|-
| 01:42
+
| 01:51
 
|As well as its contents, a file has a name and some properties, or “administrative information”; that is, the file’s creation/modification date and its permissions.  
 
|As well as its contents, a file has a name and some properties, or “administrative information”; that is, the file’s creation/modification date and its permissions.  
 
|-
 
|-
| 01:55
+
| 02:05
|The properties are stored in the file’s inode, a special block of data in the file system that also contains the length of the file and where on the disk it’s stored.  
+
|Thus  properties are stored in the file’s inode, a special block of data in the file system that also contains the length of the file and where on the disk it’s stored.  
 
|-
 
|-
| 02:08
+
| 02:20
|The system uses the number of the file’s inode; the directory structure just names the file for our benefit as its easier for us to remember names than large numbers.
+
|The system uses the number of the file’s '''inode''' ; the directory structure just names the file for our benefit as its easier for us to remember names than larger numbers.
 
|-
 
|-
|02:23
+
|02:35
 
|Contrary to its oversimplified definition, a directory doesnot actually store other files ,it is itself a file that holds the inode numbers and names of other files.  
 
|Contrary to its oversimplified definition, a directory doesnot actually store other files ,it is itself a file that holds the inode numbers and names of other files.  
 
|-
 
|-
| 02:37
+
| 02:49
 
|In fact in Linux there are three kinds of files:
 
|In fact in Linux there are three kinds of files:
 
|-
 
|-
| 02:41
+
| 02:54
|1 Regular Files or Ordinary files: It contains only data , as a stream of characters.
+
|Regular Files or Ordinary files: It contains only data , as a stream of characters.
 
|-
 
|-
| 02:48
+
| 03:01
|2 Directories: As we just saw in the previous slides.
+
|Directories: As we just saw in the previous slides.
 
|-
 
|-
| 02:52
+
| 03:07
|3 Device Files: All hardware devices and peripherals are represented as files in Linux.  
+
|Device Files: All hardware devices and peripherals are represented as files in Linux.  
 
|-
 
|-
| 02:59
+
| 03:14
 
|A CD, a Harddisk or even an usb stick, everything is a file in Linux. But why is this so? This helps to read and write these devices in a way similar to that for ordinary files.
 
|A CD, a Harddisk or even an usb stick, everything is a file in Linux. But why is this so? This helps to read and write these devices in a way similar to that for ordinary files.
 
|-
 
|-
| 03:15
+
| 03:32
 
|All files in Linux are related, in short all form a family much like we do.  
 
|All files in Linux are related, in short all form a family much like we do.  
 
|-
 
|-
| 03:22
+
| 03:39
 
|A directory containing say some files and subdirectories will have a parent – child relationship with each other. This gives rise to the Linux File System Tree.
 
|A directory containing say some files and subdirectories will have a parent – child relationship with each other. This gives rise to the Linux File System Tree.
 
|-
 
|-
| 03:34
+
| 03:52
 
|At the top is the root( denoted by a frontslash /). It contains all the other files and directories.  
 
|At the top is the root( denoted by a frontslash /). It contains all the other files and directories.  
 
|-
 
|-
| 03:42
+
| 04:04
 
|This also helps in easy navigation from one file or directory to other, if we know the correct path.  
 
|This also helps in easy navigation from one file or directory to other, if we know the correct path.  
 
|-
 
|-
| 03:51
+
| 04:12
 
|As we work with a Linux file system, it seems that we are moving along this tree.  
 
|As we work with a Linux file system, it seems that we are moving along this tree.  
 
|-
 
|-
| 03:56
+
| 04:18
 
|One command and there you are teleported from one place to other.
 
|One command and there you are teleported from one place to other.
 
|-
 
|-
| 04:01
+
| 04:24
 
|Sounds interesting!! Indeed it is. As we will see.
 
|Sounds interesting!! Indeed it is. As we will see.
 
|-
 
|-
| 04:05
+
| 04:29
 
|When we login into the Linux system we are by default in a home directory.  
 
|When we login into the Linux system we are by default in a home directory.  
 
|-
 
|-
| 04:11
+
| 04:36
 
|Now Switch to the terminal.
 
|Now Switch to the terminal.
 +
 
|-
 
|-
| 04:13
+
| 04:39
| Ctrl+alt+T helps to start a terminal in Ubuntu.
+
|To see the home directory , Type at the command prompt "'echo space dollar H-O-M-E in capital"' and press enter.
|-
+
| 04:17
+
|This command may not work in all unix systems, however. A general procedure to open a terminal is already explained in another spoken tutorial.
+
|-
+
| 04:27
+
|To see the home directory , Type at the command prompt
+
"echo space dollar H-O-M-E in capital" and press enter.
+
 
|-
 
|-
| 04:40
+
| 04:53
|This gives the pathname of our home directory.  
+
|This gives the pathname of our '''home''' directory.  
 
|-
 
|-
| 04:44
+
| 04:57
 
|We can move around from one directory to other.  
 
|We can move around from one directory to other.  
 
|-
 
|-
| 04:47
+
| 05:01
|But any time we can be in one directory and this directory is known as the current directory or working directory. Now go back to slides.
+
|But any time we can be in one directory and this directory is known as the current directory or working directory.  
 
|-
 
|-
| 04:56
+
| 05:09
|The pwd command helps us to see the current directory. pwd stands for present working directory.
+
|The '''pwd''' command helps us to see the current directory. '''pwd''' stands for present working directory.
 
|-
 
|-
| 05:03
+
| 05:18
|Type at the command prompt "pwd" and press enter. Now this is our present working directory.  
+
|Type at the command prompt '"pwd'" and press enter. Now this is our present working directory.  
 
|-
 
|-
| 05:13
+
| 05:28
 
|We have said that we can move from one directory to other.  
 
|We have said that we can move from one directory to other.  
 
|-
 
|-
| 05:17
+
| 05:32
|But how do we do so? We have the cd command for this purpose.
+
|But how do we do so? We have the '''cd''' command for this purpose.
 
|-
 
|-
| 05:22
+
| 05:39
|You have to type the command cd followed by the pathname of the directory you want to move to.
+
|You have to type the command '''cd''' followed by the pathname of the directory you want to move to.
 
|-
 
|-
| 05:28
+
| 05:47
|Lets again see our current directory by typing pwd at the command prompt and press enter.
+
|Lets again see our current directory by typing '''pwd''' at the command prompt and press enter.
 
|-
 
|-
|05:37
+
|05:57
 
| So, now we are placed in this directory.
 
| So, now we are placed in this directory.
 
|-
 
|-
| 05:41
+
| 06:01
|Now say we want to move to slash usr directory. So, type  
+
|Now say we want to move to '''slash usr''' directory. So, type "'cd space slash usr'" . Remember here slash in linux means front slash and press enter.
"cd space slash usr" . Remember here slash in linux means front slash and press enter.
+
 
|-
 
|-
| 05:56
+
| 06:17
|Now lets see our current directory. Type pwd and press enter.
+
|Now lets see our current directory. Type '''pwd''' and press enter.
 
|-
 
|-
| 06:03
+
| 06:24
|Yes we have moved to slash usr directory.  
+
|Yes we have moved to '''slash usr''' directory.  
 
|-
 
|-
| 06:08
+
| 06:30
 
|The problem here is the pathnames can be very long, this is because these are Absolute Pathnames that enlist the entire path staring from the root directory.
 
|The problem here is the pathnames can be very long, this is because these are Absolute Pathnames that enlist the entire path staring from the root directory.
 
|-
 
|-
| 06:18
+
| 06:42
 
|Instead we may use Relative pathnames that begin from the current directory.  
 
|Instead we may use Relative pathnames that begin from the current directory.  
 
|-
 
|-
| 06:23
+
| 06:48
|Here we need to know two special characters.
+
|Here we need to know two special characters. '''dot''' that represent the current directory and '''dot dot''' that represent the '''parent directory''' of the current directory.  
'''dot''' that represent the current directory and '''dot dot''' that represent the parent directory of the current directory.  
+
 
|-
 
|-
| 06:36
+
| 07:02
|Now let us have a brief session on cd command
+
|Now let us have a brief session on '''cd''' command
 
|-
 
|-
| 06:40
+
| 07:06
|The command cd without any argument is used to move back to the home directory.  
+
|The command '''cd''' without any argument is used to move back that to the home directory.  
 
|-
 
|-
| 06:46
+
| 07:13
|Type at the command prompt "cd" and press enter.  
+
|Type at the command prompt "'cd'" and press enter.  
 
|-
 
|-
| 06:51
+
| 07:19
|Now check our current directory by the pwd command.  
+
|Now check our current directory by the '''pwd''' command.  
 
|-
 
|-
| 06:55
+
| 07:23
|So, now we are back in our home directory
+
|So, now we are back in our home directory '''/home/gnuhata''' [ slash home slash gnuhata ]  
<nowiki>/home/gnuhata [ narration- slash home slash gnuhata ] </nowiki>
+
 
 
|-
 
|-
| 07:01
+
| 07:30
|Now let us move to music directory. Type at the command prompt "cd space Music(M in capital) slash" and press enter
+
|Now let us move to music directory. Type at the command prompt "'cd space Music(M in capital) slash"' and press enter
 
|-
 
|-
| 07:13
+
| 07:43
|Now check our current directory by the pwd command. pwd and press enter. See, we have moved /home/gnuhata/Music  
+
|Now check our current directory by the '''pwd''' command. '''pwd''' and press enter. See, we have moved ''' /home/gnuhata/Music '''
 
|-
 
|-
| 07:26
+
| 07:57
|Let us go to the parent directory from Music. For that you have to use cd command with dot dot.  
+
|Let us go to the parent directory of Music. For that you have to use cd command with dot dot.  
 
|-
 
|-
| 07:33
+
| 08:04
|Type at the command prompt cd space dot dot and press enter.  
+
|Type at the command prompt '''cd space dot dot''' and press enter.  
 
|-
 
|-
| 07:40
+
| 08:11
|Now check our present directory by typing pwd. We are again in /home/gnuhata
+
|Now check our present directory by typing '''pwd.''' We are again in '''/home/gnuhata'''
 
|-
 
|-
| 07:51
+
| 08:23
 
|Now lets try to move to a subdirectory of the current directory using dot.  
 
|Now lets try to move to a subdirectory of the current directory using dot.  
 
|-
 
|-
| 07:58
+
| 08:30
|Type at the command prompt cd space dot slash Documents(D in capital) slash. Press enter.
+
|Type at the command prompt '''cd space dot slash Documents(D in capital) slash'''. Press enter.
 
|-
 
|-
| 08:09
+
| 08:42
|Check our current directory by typing pwd. We are at /home/gnuhata/Documents
+
|Check our current directory by typing '''pwd.''' We are at ''' /home/gnuhata/Documents'''
 
|-
 
|-
| 08:19
+
| 08:53
 
|Let me clear the screen by pressing control L. So you can see clearly.
 
|Let me clear the screen by pressing control L. So you can see clearly.
 
|-
 
|-
| 08:23
+
| 08:58
|To go back to our home directory by cd command.
+
|To go back to our home directory by '''cd''' command. Type '''cd''' and press enter.
Type cd and press enter.
+
 
|-
 
|-
| 08:32
+
| 09:07
|Again check our current directory by pwd command. We are back to /home/gnuhata .  
+
|Again check our current directory by '''pwd''' command. We are back to '''/home/gnuhata''' .  
 
|-
 
|-
| 08:41
+
| 09:17
|<nowiki>We can combine any number of .. [narration - dot dot] separated by / [narration- slash] in a relative path . </nowiki>
+
|We can combine any number of dot dot separated by slash in a relative path .  
 
|-
 
|-
| 08:47
+
| 09:23
|In this slide, we can see the file system hierarchy. Root or / is at the top. home and bin are two sub-directories under root. username , here the directory named gnuhata is a sub-directory under home.
+
|In this slide, we can see the file system hierarchy. '''Root''' or '''slash''' is at the top. '''home''' and '''bin''' are two sub-directories under '''root'''. '''username''' , here the directory named gnuhata is a sub-directory under '''home.'''
 
|-
 
|-
| 09:05
+
| 09:43
| So, now we are in /home/gnuhata. Now how can we go to the bin directory?  
+
| So, now we are in '''/home/gnuhata.''' Now how can we go to the bin directory?  
 
|-
 
|-
| 09:12
+
| 09:51
|Type at the command prompt
+
|Type at the command prompt "'cd space dot dot slash dot dot slash bin'" and press enter.  
"cd space dot dot slash dot dot slash bin" and press enter.  
+
 
 
|-
 
|-
| 09:23
+
| 10:03
|Check our current directory by the command pwd.  
+
|Check our current directory by the command '''pwd.'''  We are at /bin (slash bin)
<nowiki>We are at /bin [narration - slash bin] </nowiki>
+
 
 
|-
 
|-
| 09:30
+
| 10:11
|<nowiki>The first .. [narration-dot dot] takes us from /home/gnuhata [narration - slash home slash gnuhata] to /home [narration - slash home].</nowiki>
+
|The first .. (dot dot) takes us from /home/gnuhata (slash home slash gnuhata) to /home (slash home)
  
 
|-
 
|-
| 09:37
+
| 10:18
|<nowiki>The next takes us from /home to </nowiki>root.  
+
|The next takes us from '''slash home''' to root.  
 
|-
 
|-
| 09:43
+
| 10:24
|Now from / or root, we have moved to /bin directory.
+
|Now from root or slash, we have moved to /bin directory.
 
|-
 
|-
| 09:48
+
| 10:30
|Go back to our home directory by the command cd.  
+
|Go back to our home directory by the command '''cd.'''
 
|-
 
|-
| 09:52
+
| 10:34
|To create a directory we use the mkdir command.  
+
|To create a directory we use the '''mkdir''' command.  
  
 
|-
 
|-
| 09:56
+
| 10:40
 
|You have to type the command and name of directory to be created and a directory would be created under the current directory.
 
|You have to type the command and name of directory to be created and a directory would be created under the current directory.
 
|-
 
|-
| 10:04
+
| 10:49
|To create a directory named testdir, type the command "mkdir space testdir" and press enter.
+
|To create a directory named '''testdir''', type the command '"mkdir space testdir'" and press enter.
 
|-
 
|-
| 10:15
+
| 11:01
|This creates the testdir directory successfully.  
+
|This creates the '''testdir''' directory successfully.  
 
|-
 
|-
| 10:19
+
| 11:05
 
|Note that, there is no explicit notification of successful directory creation or removal.
 
|Note that, there is no explicit notification of successful directory creation or removal.
 
|-
 
|-
| 10:25
+
| 11:13
 
| If you do not get any error message, it denotes successful execution.  
 
| If you do not get any error message, it denotes successful execution.  
 
|-
 
|-
| 10:30
+
| 11:18
 
|We can also use the relative or absolute pathname to create a directory anywhere in the tree provided we have the permission to do so and a directory by that name does not already exist.
 
|We can also use the relative or absolute pathname to create a directory anywhere in the tree provided we have the permission to do so and a directory by that name does not already exist.
 
|-
 
|-
| 10:43
+
| 11:33
 
|This process can be used for making multiple directories or even a hierarchy of directories.
 
|This process can be used for making multiple directories or even a hierarchy of directories.
 
|-
 
|-
| 10:49
+
| 11:39
|Type "mkdir space test1 space test2 and press enter ,this will make two directories named test1 and test2 under the present directory.
+
|Type "'mkdir space test1 space test2''' and press enter ,this will make two directories named '''test1''' and '''test2''' under the present directory.
 
|-
 
|-
| 11:06
+
| 11:57
|Type "mkdir space testtree space testtree slash test3".  
+
|Type "'mkdir space testtree space testtree slash test3'".  
 
|-
 
|-
| 11:20
+
| 12:11
|This will make a directory testtree and another directory test3 which is a sub-directory under testtree.  
+
|This will make a directory '''testtree''' and another directory '''test3''' which is a sub-directory under '''testtree.'''
 
|-
 
|-
| 11:28
+
| 12:20
|So, we have created four directories namely testdir,test1,test2 and testtree in the current directory, out of which first three are empty and the last one contains a subdirectory namely test3.  
+
|So, we have created four directories namely '''testdir,test1,test2 '''and '''testtree''' in the current directory, out of which first three are empty and the last one contains a subdirectory namely test3.  
 
|-
 
|-
| 11:47
+
| 12:40
|Similar to mkdir is the rmdir command which is used for removing a directory or directories.
+
|Similar to the '''mkdir''' is the '''rmdir''' command which is used for removing a directory or directories.
 
|-
 
|-
| 11:56
+
| 12:50
|The command "rmdir space test1" removes the test1 directory successfully.  
+
|The command "'rmdir space test1'" removes the '''test1''' directory successfully.  
 
|-
 
|-
| 12:09
+
| 13:00
 
|A directory can be removed only if you are its owner, your current directory is hierarchically above the directory to be removed and the directory is empty.
 
|A directory can be removed only if you are its owner, your current directory is hierarchically above the directory to be removed and the directory is empty.
 
|-
 
|-
| 12:23
+
| 13:13
|Now type at the command prompt
+
|Now type at the command prompt '"cd space testtree slash test3"'
"cd space testtree slash test3"
+
 
|-
 
|-
| 12:35
+
| 13:25
|So, we are now in test3 directory which is a subdirectory under testtree.
+
|So, we are now in '''test3''' directory which is a subdirectory under '''testtree.'''
 
|-
 
|-
| 12:42
+
| 13:33
|Lets try to remove the testdir directory by typing the command "rmdir space testdir". Press enter.  
+
|Lets try to remove the '''testdir''' directory by typing the command '"rmdir space testdir'". Press enter.  
 
|-
 
|-
| 12:55
+
| 13:46
 
|We see it can't be done, because the current directory is not hierarchically above the directory to be removed.
 
|We see it can't be done, because the current directory is not hierarchically above the directory to be removed.
 
|-
 
|-
| 13:02
+
| 13:54
|So,we have to go to the directory which is hierarchically above testdir directory.  
+
|So,we have to go to the directory which is hierarchically above '''testdir''' directory.  
 
|-
 
|-
| 13:08
+
| 14:00
|Type "cd space dot dot" and press enter.  
+
|Type "'cd space dot dot"' and press enter.  
 
|-
 
|-
| 13:14
+
| 14:06
|Now, go back to our parent directory by typing the command "cd space dot dot".  
+
|Now, go back to our parent directory by typing the command "'cd space dot dot'".  
 
|-
 
|-
| 13:20
+
| 14:13
 
|Now, again try the previous command.  
 
|Now, again try the previous command.  
 
|-
 
|-
| 13:24
+
| 14:16
 
|Type "rmdir space testdir". Press enter.  
 
|Type "rmdir space testdir". Press enter.  
 
|-
 
|-
| 13:30
+
| 14:23
|The testdir directory is successfully deleted. Note that, testdir directory was also empty.
+
|The '''testdir''' directory is successfully deleted. Note that, '''testdir''' directory was also empty.
 
|-
 
|-
| 13:38
+
| 14:32
|Multiple directories or a hierarchy of directories can be removed at once.So, try to delete the testtree directory along with its subdirectory test3.  
+
|Multiple directories or a hierarchy of directories can be removed at once.So, try to delete the '''testtree''' directory along with its subdirectory '''test3.'''
 
|-
 
|-
| 13:48
+
| 14:43
|Type at the command prompt
+
|Type at the command prompt '"rmdir space testtree space testtree slash test3'" press enter.
"rmdir space testtree space testtree slash test3 "press enter.
+
 
|-
 
|-
| 14:02
+
| 14:57
|See, it is giving the error message that 'testree' directory cannot be removed because testtree is not empty.  
+
|See, it is giving the error message that '''testree''' directory cannot be removed because testtree is not empty.  
 
|-
 
|-
| 14:11
+
| 15:07
|But one thing which you may miss is that testtree/test3 has been deleted as it was empty.  
+
|But one thing which you may miss is that '''testtree slash test3''' has been deleted as it was empty.  
 
|-
 
|-
| 14:19
+
| 15:16
|To check that, type at the command prompt "cd space testtree" and press enter.
+
|To check that, type at the command prompt "'cd space testtree"' and press enter.
 
|-
 
|-
| 14:27
+
| 15:25
|Now type "ls" and press enter. See, the directory contains nothing. So, test3 was deleted.
+
|Now type "'ls'" and press enter. See, the directory contains nothing. So, '''test3''' was deleted.
 
|-
 
|-
| 14:36
+
| 15:34
 
|So in this linux tutorial we have learnt about Linux Files and directories and how to work with Linux Directories. See them, move between them, make them,remove them.  
 
|So in this linux tutorial we have learnt about Linux Files and directories and how to work with Linux Directories. See them, move between them, make them,remove them.  
 
|-
 
|-
| 14:49
+
| 15:48
 
|This brings me to the end of this tutorial. Spoken Tutorials are a part of the Talk to a Teacher project, supported by the National Mission on Education through ICT.
 
|This brings me to the end of this tutorial. Spoken Tutorials are a part of the Talk to a Teacher project, supported by the National Mission on Education through ICT.
 
|-
 
|-
| 15:03
+
| 16:02
 
|More information this is available at the following link  
 
|More information this is available at the following link  
 
|-
 
|-
| 15:08
+
| 16:08
|This script has been contributed by ----------------------(name of the translator) and this is -----------------------(name of the recorder) from --------------------------(name of the place)signing off . Thanks for joining.
+
|This is Anusha Kadambala signing off. Thanks for joining.
  
 
|}
 
|}

Revision as of 12:50, 4 December 2014

Time Narration
00:00 Welcome to this spoken tutorial on Linux File System.
00:04 I am using Linux Operating system.
00:08 We assume that you know how to get started with the Linux operating system and have some basic idea about commands.
00:16 If you are interested, it is available through another spoken tutorial, on the following website http://spoken-tutorial.org
00:28 Also note that linux is case sensitive.
00:32 All the commands used in this tutorial are in lower case unless otherwise mentioned.
00:41 In Linux almost everything is a file.
00:44 So what is a file? In real life we know that a file is where we store our documents and papers.
00:54 Similarly in Linux a file is a container for storing information.
01:00 Next what is a directory?
01:03 A directory can be understood as a collection of files and other (sub)directories.
01:10 A directory helps us in organising our files in a systematic manner.
01:16 This is like what we call folders in Windows.
01:20 It allows different users to have their own directories with their files which others cannot access or modify.
01:30 Also if there are no directories, all the files on the system need to have unique names,which would be very difficult to maintain.
01:41 These definitions of files and directories are good to get a general feel about them, they are not entirely accurate.
01:51 As well as its contents, a file has a name and some properties, or “administrative information”; that is, the file’s creation/modification date and its permissions.
02:05 Thus properties are stored in the file’s inode, a special block of data in the file system that also contains the length of the file and where on the disk it’s stored.
02:20 The system uses the number of the file’s inode ; the directory structure just names the file for our benefit as its easier for us to remember names than larger numbers.
02:35 Contrary to its oversimplified definition, a directory doesnot actually store other files ,it is itself a file that holds the inode numbers and names of other files.
02:49 In fact in Linux there are three kinds of files:
02:54 Regular Files or Ordinary files: It contains only data , as a stream of characters.
03:01 Directories: As we just saw in the previous slides.
03:07 Device Files: All hardware devices and peripherals are represented as files in Linux.
03:14 A CD, a Harddisk or even an usb stick, everything is a file in Linux. But why is this so? This helps to read and write these devices in a way similar to that for ordinary files.
03:32 All files in Linux are related, in short all form a family much like we do.
03:39 A directory containing say some files and subdirectories will have a parent – child relationship with each other. This gives rise to the Linux File System Tree.
03:52 At the top is the root( denoted by a frontslash /). It contains all the other files and directories.
04:04 This also helps in easy navigation from one file or directory to other, if we know the correct path.
04:12 As we work with a Linux file system, it seems that we are moving along this tree.
04:18 One command and there you are teleported from one place to other.
04:24 Sounds interesting!! Indeed it is. As we will see.
04:29 When we login into the Linux system we are by default in a home directory.
04:36 Now Switch to the terminal.
04:39 To see the home directory , Type at the command prompt "'echo space dollar H-O-M-E in capital"' and press enter.
04:53 This gives the pathname of our home directory.
04:57 We can move around from one directory to other.
05:01 But any time we can be in one directory and this directory is known as the current directory or working directory.
05:09 The pwd command helps us to see the current directory. pwd stands for present working directory.
05:18 Type at the command prompt '"pwd'" and press enter. Now this is our present working directory.
05:28 We have said that we can move from one directory to other.
05:32 But how do we do so? We have the cd command for this purpose.
05:39 You have to type the command cd followed by the pathname of the directory you want to move to.
05:47 Lets again see our current directory by typing pwd at the command prompt and press enter.
05:57 So, now we are placed in this directory.
06:01 Now say we want to move to slash usr directory. So, type "'cd space slash usr'" . Remember here slash in linux means front slash and press enter.
06:17 Now lets see our current directory. Type pwd and press enter.
06:24 Yes we have moved to slash usr directory.
06:30 The problem here is the pathnames can be very long, this is because these are Absolute Pathnames that enlist the entire path staring from the root directory.
06:42 Instead we may use Relative pathnames that begin from the current directory.
06:48 Here we need to know two special characters. dot that represent the current directory and dot dot that represent the parent directory of the current directory.
07:02 Now let us have a brief session on cd command
07:06 The command cd without any argument is used to move back that to the home directory.
07:13 Type at the command prompt "'cd'" and press enter.
07:19 Now check our current directory by the pwd command.
07:23 So, now we are back in our home directory /home/gnuhata [ slash home slash gnuhata ]
07:30 Now let us move to music directory. Type at the command prompt "'cd space Music(M in capital) slash"' and press enter
07:43 Now check our current directory by the pwd command. pwd and press enter. See, we have moved /home/gnuhata/Music
07:57 Let us go to the parent directory of Music. For that you have to use cd command with dot dot.
08:04 Type at the command prompt cd space dot dot and press enter.
08:11 Now check our present directory by typing pwd. We are again in /home/gnuhata
08:23 Now lets try to move to a subdirectory of the current directory using dot.
08:30 Type at the command prompt cd space dot slash Documents(D in capital) slash. Press enter.
08:42 Check our current directory by typing pwd. We are at /home/gnuhata/Documents
08:53 Let me clear the screen by pressing control L. So you can see clearly.
08:58 To go back to our home directory by cd command. Type cd and press enter.
09:07 Again check our current directory by pwd command. We are back to /home/gnuhata .
09:17 We can combine any number of dot dot separated by slash in a relative path .
09:23 In this slide, we can see the file system hierarchy. Root or slash is at the top. home and bin are two sub-directories under root. username , here the directory named gnuhata is a sub-directory under home.
09:43 So, now we are in /home/gnuhata. Now how can we go to the bin directory?
09:51 Type at the command prompt "'cd space dot dot slash dot dot slash bin'" and press enter.
10:03 Check our current directory by the command pwd. We are at /bin (slash bin)
10:11 The first .. (dot dot) takes us from /home/gnuhata (slash home slash gnuhata) to /home (slash home)
10:18 The next takes us from slash home to root.
10:24 Now from root or slash, we have moved to /bin directory.
10:30 Go back to our home directory by the command cd.
10:34 To create a directory we use the mkdir command.
10:40 You have to type the command and name of directory to be created and a directory would be created under the current directory.
10:49 To create a directory named testdir, type the command '"mkdir space testdir'" and press enter.
11:01 This creates the testdir directory successfully.
11:05 Note that, there is no explicit notification of successful directory creation or removal.
11:13 If you do not get any error message, it denotes successful execution.
11:18 We can also use the relative or absolute pathname to create a directory anywhere in the tree provided we have the permission to do so and a directory by that name does not already exist.
11:33 This process can be used for making multiple directories or even a hierarchy of directories.
11:39 Type "'mkdir space test1 space test2 and press enter ,this will make two directories named test1 and test2 under the present directory.
11:57 Type "'mkdir space testtree space testtree slash test3'".
12:11 This will make a directory testtree and another directory test3 which is a sub-directory under testtree.
12:20 So, we have created four directories namely testdir,test1,test2 and testtree in the current directory, out of which first three are empty and the last one contains a subdirectory namely test3.
12:40 Similar to the mkdir is the rmdir command which is used for removing a directory or directories.
12:50 The command "'rmdir space test1'" removes the test1 directory successfully.
13:00 A directory can be removed only if you are its owner, your current directory is hierarchically above the directory to be removed and the directory is empty.
13:13 Now type at the command prompt '"cd space testtree slash test3"'
13:25 So, we are now in test3 directory which is a subdirectory under testtree.
13:33 Lets try to remove the testdir directory by typing the command '"rmdir space testdir'". Press enter.
13:46 We see it can't be done, because the current directory is not hierarchically above the directory to be removed.
13:54 So,we have to go to the directory which is hierarchically above testdir directory.
14:00 Type "'cd space dot dot"' and press enter.
14:06 Now, go back to our parent directory by typing the command "'cd space dot dot'".
14:13 Now, again try the previous command.
14:16 Type "rmdir space testdir". Press enter.
14:23 The testdir directory is successfully deleted. Note that, testdir directory was also empty.
14:32 Multiple directories or a hierarchy of directories can be removed at once.So, try to delete the testtree directory along with its subdirectory test3.
14:43 Type at the command prompt '"rmdir space testtree space testtree slash test3'" press enter.
14:57 See, it is giving the error message that testree directory cannot be removed because testtree is not empty.
15:07 But one thing which you may miss is that testtree slash test3 has been deleted as it was empty.
15:16 To check that, type at the command prompt "'cd space testtree"' and press enter.
15:25 Now type "'ls'" and press enter. See, the directory contains nothing. So, test3 was deleted.
15:34 So in this linux tutorial we have learnt about Linux Files and directories and how to work with Linux Directories. See them, move between them, make them,remove them.
15:48 This brings me to the end of this tutorial. Spoken Tutorials are a part of the Talk to a Teacher project, supported by the National Mission on Education through ICT.
16:02 More information this is available at the following link
16:08 This is Anusha Kadambala signing off. Thanks for joining.

Contributors and Content Editors

PoojaMoolya, Sandhya.np14