Bloggers come to a new lesson the next lesson is about how to remove files or directories by the are
and are in dire commands.
First of all I'll type L as to display the contents that I have over here.
Now first of all what is the difference between our entire And our end there are in dire.
Over here is the command used to remove directories but it can't be used to remove files while the are
in command can remove directories and files.
Ok now I would like to remove the directory direr to for example.
So I will type are in there and then D are two and then press enter.
And as you see it didn't display any error messages.
So this means that the command has been executed successfully and the Directory has been removed.
If you type L S and enter you can see that the directory has been removed from here.
Let's for example now try to remove directory the one over here I will type the same command again are
in there and then Dyar one and enter.
And as you see it displayed an error message that the directory is not empty.
And this means that I can remove a directory that contains files or directories by using the are in
their command.
So the they can only remove empty directories.
Wilda are in command can remove directories that contains files and directories.
But before we get to that let's have another quick example.
Ok so I would like to remove the directory direr 6
and s as you can see it has been successfully removed from here.
Now I'll clear the page and display the contents one more time.
OK now to the r m comment.
Now the r in command can remove files and directories.
So now I'll remove the file.
File 3 for example over here with the R M command I will type R M and then file 3 and enter.
As you can see it will ask me remove regular empty file file 3 if I press on why this means yes and
if I press on and this will mean no.
So let's give it to no first and we will try the comment one more time and this time I'll give it a
yes.
OK and now if you type L S you can see that the file filed three has been removed from here.
OK now let's remove a directory.
For example I would like to remove the directory direr 7 by the same command.
M so I'll type R M and then they are 7 and enter.
And as you can see it's telling me it cannot remove direr 7 is a directory and that's because you will
have to add an option to the r.
If you want to remove a directory and this option will be minus or so I will type.
Or minus R and then direr 7.
And then enter
and it's asking me if I want to remove the directory 7c will press y to proceed and then press enter.
OK so now the R7 was an empty Levick too.
What about if I type the same command for a directory that contains files and directories.
I will try with a directory that contains a file in the directory which is this directory over here.
There one so I was type.
Or minus R and then type 1 and enter
case asking me to descend into a directory Darwan if I press NY and enter it will ask me to remove the
rest of the contents inside the directory to do a press Y and enter to ask me if I want to remove the
rigor into file kick.
This is the name of the file which is inside the directory Darwan press Y and enter now and then that's
asking me if I want to remove the directory one so first of all it asked me if I want to remove the
directory Dyar which is inside one.
And then I give it a y.
So this means yes.
And then it asked me if I want to remove that file kick which is also inside the directory Dyar one.
And then I pressed Y which is.
Which means yes.
And after I have removed the directory and the files that are inside the directory are one there are
no more directories or files so the last step now is removing the directory there one itself which contained
the the file and the directory.
So now are press on why and then enter and as you can see it has removed the directory Dyar one and
the directory and the files that were inside the directory there one.
So under the directory either one we had a directory by the name there.
And we had a file by the name kick.
It asked us first to remove the directory and then remove the file and then remove the directories like
step by step from deeper to outward outward until you remove the whole directory and all its contents.
Now all clear and l s k now the last time I have removed the file it has asked me a question if I am
sure if I want to remove it or not.
So now what if I want to remove a file without the terminal asking me if I am sure then I will add the
option minus.
So this time for example I would like to delete the file files too.
I will type or minus F and then type files to and this time it will not ask me if I'm sure if I want
to delete this file or remove this file because I have added the option minus F I'll press enter.
As you can see it has removed it by type L S and take a look you'll see it's not in here.
OK.
Now I would like to see a summary of the process of removing a file or directory.
Then I'll add the option minus the
and I also don't want it to ask me about if I'm sure if I want to delete it which means that I will
add minus f.
So this will mean that I will combine the option V and F together with the R and command and that's
right this was the file file for I'll type r m minus the F and then type file for.
So this means that I'll combine two options.
The option might A.V. and the option minus the minus V to show me the process or the summary of the
process.
So it's the summary of the process has and the minus f so that it won't ask me if I want to delete it
or not and I press enter.
And as you can see it gave me a summary over here removed file for.
So in here as you can see I did not add the option minus R because this is not a directory.
It's a file.
Ok now I would like to remove whatever to see and see the summary of the process.
And I don't want the terminal to ask me if I am sure.
So for example I would like to remove the directory.
There are three over here so I'll type r m minus are in the beginning because this is a directory I
had to add the option.
My notes are and then the option of V because I would like to see the summary of the process and then
f so that it won't ask me if I'm sure if I want to delete or not and then I'll type d o y or 3 the name.
Sorry about that.
The name of the directory that I would like to remove here and enter in as you can see it showed me
a summary of the process that the directory tree has been removed.
And by this as we have seen there are and are in dire commands to remove files or directories.
Thank you for watching and see you in the next session.