 Hello, today I am going to discuss on the topic system calls for the file system part 2. Let us see learning outcome of this topic. At the end of this session, students will be able to explain file and related system calls. Here file system is a major part in the Unix operating system, where file system maintains the file creation, file managing all the files, then performing all the commands which are related to the file system. So, file system is maintained by the kernel in the form of hierarchical structure. So, the user can perform any file operation in the file system following the different file system commands. Along that we have to see the first file system commands, the syntax is change directory. The syntax is change directory. The change directory means the changing the directory from current path to the next path. So, that is why the syntax of the change directory system call is chdir pathname. Chdir pathname is the directory that becomes the new current directory of the process. So, actually pathname is followed in two ways. One is absolute pathname and another is relative pathname. Absolute pathname is related to the hierarchical file system and relative pathname is related to the current directory of the process. Next user can change the root of the pathname. For that the syntax is change root chrot pathname, again pathname is the directory that the kernel subsequently treats as the process root directory. Here we have some examples related to that. Suppose the user wants to move the sample folder from the current directory. So, the user has to type cd space slash user slash local slash sample and then the user has to check whether the sample folder is present or not for that type pwd, pwd stands for present working directory. So, it displays output slash user slash local slash sample. It shows that user is now presently in the sample directory. To change to another folder user has to type cd space var slash local slash logs. Again he has to check pwd that is present working directory so that where he is present in the logs directory or not. Now, I am presently working as cd directory so I want to move up one folder. In that case you have to type cd space dot dot. So, again we check using pwd command yes now we are moving up one folder that is we are moving from sample to local or we are moving from logs to local. Then quickly get back so for that we have to type cd's enter then check whether we are present in the sample directory pwd user slash local slash sample directory. So, these are the examples which are related to the change directory or change root. Again here change root examples change to new root user wants to move from one directory to the other that is from the root system to the other. For that we have to type the ch root ch root home slash new bin slash bin slash bash. This is the actually command for changing the home directory to the batch directory. And then run the command from the new root ls then we show that we are present in the new bin slash bin or slash batch directory then we want to exit from the new root so user has to type exit so we are coming out of the new root of the file system. Change owner in the unit file system every file has owner every file has group and every file has other so the user has to create a file owner has to create a file and group has to create a file owner has a permission to change the mode then group has permission to change the mode and other people are also make the changes in the owner. So to change the owner the syntax for change owner is ch or even path name owner and group. So here path name is absolute path name or relative path name and owner is the owner of the group and group is a group which contains a group of people. The syntax for the change mode is change mode ch mod path name comma mode. Here path name again we describe as a absolute path name or relative path name mode describes symbolic mode or numeric mode. Here the example of change owner change owner of the file we type change own user one file name that is sample dot txt and to change the group of the file change owner my group file name dot txt. Here in the two example in the first example the file of the sample dot txt the owner of the file sample dot txt has changed and the second the group of the file dot txt has changed change mode example. So here few examples we show with the help of change mode to deny exude permission to everyone so change mode a dash x a stand for all people and dash x means to deny the exit permission for the file sample dot txt then allow the read permission to everyone we type ch mod a that is all plus r indicates readable to all people for the file sample dot txt make the file readable and writable by the group and the others and change mode go here go stands for group and others and we give them read and write permission for the file sample dot txt then make shell script executable change mode user use stand for user has permission plus x that is exude permission for the file sample script dot sh stat and fstat the stats stand for status fstands are for file status. So the syntax for the stat command is stat path name and state buffer here fstat in path name file descriptor and state buffer where path name is here file name where the file consists in the absolute path name or redo path name fd is the file descriptor returned by the previous open call state buffer is the address of data structure in the user process that will contain status information of the file on completion of the call actually where we use the stat and fstat it take the status of the information where the user file is contained or completed when the call is entered in that case we use stat and fstat very important command in the Unix operating system is a pipe what is the technique of this pipe is a technique for passing information from one program process to another a pipe passes a parameter such as the output of one process to another process which accept it as a input so what is the meaning of pipe is when we want the we want to connect the output of one process to the input of another process in that case we are using pipe technique which is very very important for the file system in the Unix operating system now here we are using the symbol as a vertical bar is the Unix pipe symbol that is used on the command line based on this pipe we have an example so we have one file that is apple.xt which I want to display with the help of command cat apple.xt where we use the cat command to display the contents of the file so in the apple.xt we have the contents core, warm, sealed, gw. now I want to measure the number of lines the number of words and number of characters from this file so I have to use a pipe command means I have to pass the output of one command to the input of the other command so here again I want to pass the output of cat apple.xt to the input of word count that is a w c so what is the output of the apple.xt is these three sentences and then they count the number of words number of words and number of characters in the file apple.txt example 2 is again I am passing the output of one command to the input of another command that is w c and I am passing these to my mail account with the subject the count so we type cat apple.txt word count mail as s the count the count is my subject name and this will send to the message nobody at gmail.com ok now let us see the some questions based on the previous contents the question is which command is used to change the permission of a file second question is what does the command ls pipe symbol w c dash l file 1 do let us see the answer of first question which command is used to change the permission of a file yes we have seen earlier that chm od is the command which is used to change the permission of the file that is called a change mode command let us see the answer of second question what is what does the command ls pipe symbol w c dash l related to file 1 the answer is ls becomes the input to w c command that is word count command which counts the number of lines it receives as the input and instead of displaying this count the value is stored in file 1 here the value directly stored to the file 1 that is why in the second question we are using greater the symbol that is for re-elected the output to the file 1 these are the references thank you