Hello everyone.
In this demo, I'm going to show you how to remove directories and files.
If I would like to remove an empty directory, I'm going to run the command rmdir.
Then the name of the directory.
For example.
Directory four hit enter.
Now I'm going to double check if I do have the directory I don't have directory for here anymore.
Assume that I have a directory and subdirectories and I would like to remove the sub directory.
So what I'm going to do, I'm going to use the same command r MDR and I have here D one and inside d
one there is D two.
I'm going to remove D two.
Then I hit enter.
Let's double check D one.
As we can see here, we don't have d two anymore.
If I would like to delete parents so the directory and even the sub directory for example, here we
have Linux and inside Linux we have another directory or sub directory.
It's called RedHat.
So I'm going to type out MDR.
Then I have to type the option dash P, this is appearance.
So he's going to delete the directory and the sub directory.
So Linux then Red Hat I hit enter lSl.
As we can see here, we don't have.
The Linux directory anymore.
If I would like to get more information about this command, I can go to the man page and we can get
more details and information about the Dir command.
There is another command also we can use.
And let's go to the man page of the r m so r m removes files and directories.
So for the previous command, the rmdir that one is just to remove directories, but for the rm it remove
so the removes files and directories.
So okay, let's go back here.
And what I would like to do right now, I would like to remove, for example, the text file here.
And f1 dot txt.
Let's double check so we don't have the text file anymore.
F1 dot txt.
If I would like to remove a directory, for example, assume that I would like to remove directory three
so rme.
However, for this command we have to use the recursive.
The dash r in case if there is any subdirectories inside the directory.
So.
And then I'm going to type dir three hit enter L.
As we can see here, we don't have directory three here anymore.
Now if I would like.
To run the option dash.
I for example here the dash I in order to promote or to ask us the system will ask the user before every
removal.
If you are sure you want to delete this text file.
For example, if I would like to delete if for.
I'm going to type a force.
So the system will promote a question so you can see it here.
Now I have to answer.
Yes.
Hit enter.
As you can see here, so we don't have F4 anymore.
And there is also another option.
It's dash.
If it's full dash f like force, if I would like to force the system to remove the file, for example,
I'm going to force the system to delete this directory.
I'm going to hit enter L.
As we can see here, we do have D one anymore.
If I would like to remove all the text files.
So I'm going to r m dash r then I'm going to type star dot txt.
So in this command I'm going to tell the system that I would like to remove all the text file so anything
doesn't matter.
We start with what dot txt as long as the file ends with the txt.
So the system will remove that text file.
Hit enter lSl.
As we can see here, we don't have any text file anymore.
If I would like to remove the directories.
Also I'm going to do the same thing.
R m r.
So our m r dash r.
This is for the recursive.
Then I'm going to type d i r then star.
So as we can notice here, we have one and two.
So and they are they have the same name.
They like they share the dir and the dir at the beginning.
So I would like to I'm going to tell the system to delete all the directories.
It doesn't matter what's the ending of this directory to enter right now?
lSl As we can see here, we don't have the directories here anymore.
We would like to get more information.
As I mentioned, I can go to the main page of the RM, so you can see here we can find more information
about this command and also we can find the options that we can use with this command.
Thus conclude our session.
Thank you and see you in the next lesson.