‫-: Hi, within this lecture we are gonna focus on moving,
‫deleting the files and folders
‫in order to master the navigation.
‫So, right now I'm gonna go into the documents.
‫Okay, and if I write ls, I can see that notes.txt
‫and test and test2 folders are over here.
‫Obviously, can create your own files and folders
‫in order to test this stuff.
‫So we are obviously inside of /home/kali/documents, right?
‫And I know that there are other folders
‫inside of /home/kali.
‫Right, because I can see them like downloads, music,
‫pictures public and stuff.
‫So assume that I wanna put the notes.txt
‫into test folder, okay.
‫So maybe I want to move it, maybe I want to copy it.
‫I can do both by cutting
‫or copying the thing over here, right.
‫Because it's just GUI, it's very basic to do so.
‫And you know how to do that
‫from Windows and other operating systems.
‫But idea over here is to learn how to do that
‫within the terminal.
‫And it appears that the commands to do that are very easy.
‫Like there are two commands, cp and mv.
‫cp stands for copying, mv stands for moving.
‫Okay, so moving is like cutting the file
‫and pasting into something else like some other folder.
‫And copying is just copying the file
‫and pasting in some other folder.
‫So we're gonna see both.
‫Let's assume that I wanna copy the notes.txt
‫into the test folder, okay.
‫So I can do that, copy notes.txt
‫but I can't do that because I'm inside of the documents.
‫If I run ls, I can see notes.txt.
‫Let's assume that I want to do that
‫from another folder.
‫Let's assume that I'm inside of the downloads
‫but I still want to copy the notes.txt
‫inside of the documents.
‫So maybe I can explicitly state
‫that it's /home/kali/documents/notes.txt, okay.
‫But since I'm inside of the documents,
‫I can just do that copy, notes.txt.
‫All I gotta do is just to state where I want to copy this.
‫So I want to copy this inside of the test folder.
‫And also I want to state the file name
‫that I will be copying, like test/notes.txt, okay.
‫I can just state another file name here as well
‫but I'm just gonna keep it as notes.txt.
‫So you can write copy notes.txt at the right side
‫if you want to rename this while copying, okay.
‫So if I run that, it'll just execute this command
‫and it will put the notes.txt, copy the notes.txt,
‫and paste it under the test folder.
‫So let's do that and let's cd into,
‫let me run ls.
‫As you can see, notes.txt is still here.
‫Let me go into the test and if I write ls, here you go,
‫notes.txt just appeared over here because I've copied it.
‫Okay, now we have seen copy.
‫So you write the thing that you may wanna copy
‫and you write the thing that you may want to move that into.
‫Okay, so this is how copy works.
‫So let's see, we are inside of test
‫and we still have notes.txt.
‫Let's assume that I want to delete it.
‫So in order to delete it,
‫I can use rm command which stands for removing, okay.
‫If you execute this command, here you go.
‫You deleted notes.txt, which is cool.
‫Right, all you gotta do is just write this command.
‫Obviously, right now if I write ls, you won't see anything.
‫And obviously, if I go back to the documents
‫I can still see
‫the test that notes.txt over there
‫because I have only deleted the copy of it.
‫And by the way, you don't even have to know everything
‫about this commands.
‫Right, because it's just simple right now.
‫But it may get complicated after a while.
‫And all you gotta do is to understand the logic behind this
‫and maybe you may want to familiarize yourself
‫in order to read documentation.
‫So let me do an example.
‫So I'm going to create a folder over here
‫with rmtest, okay.
‫So I, it's just a folder inside of the test folder, okay.
‫It's just a folder.
‫I can see that when I write ls. I can see the rmtest.
‫Let me try to delete that by removing it, okay.
‫So as you can see, it gives me an error.
‫It says that cannot remove rmtest, it's a directory.
‫So it seems that the rmtest is a folder
‫and we cannot actually delete the folders with rm command.
‫So let me run this,
‫let me run rm help
‫to see the documentation about rm.
‫So rm is actually a binary and like a executable
‫and they all have this documentation.
‫Most of the time you can reach them
‫by adding this --help at the end of the command, okay.
‫So that it can actually show you the documentation,
‫the help module of the rm binary.
‫Okay, if you do that,
‫I'm not even sure if it's going to show us,
‫but if it's not --help,
‫it's something like -h.
‫And as you can see, it shows us the usage,
‫it shows us the different parameters that we can give to rm.
‫And if I take a look over here,
‫there is some parameter called -r,
‫and it says that remove directories.
‫So yeah, maybe I've forgotten how to remove the directories
‫or delete the directories.
‫I can just see that by writing rm --help, okay.
‫For example, there is another parameter over here, -f.
‫It's just deletes the thing with -f with force, okay.
‫So no matter what, it just deletes the thing.
‫So as you can see, rmtest is a folder.
‫And let me write this rm -r and rmtest.
‫And here you go.
‫Now it got deleted.
‫So let me try to create some,
‫let me try to write ls.
‫And here you go, we don't have anything else.
‫Let me just create it one more time
‫and I'm gonna show you rm -rf.
‫And again, this is by force,
‫it means that just delete the thing
‫without thinking anything else, okay.
‫So even if you get like a warning message or error message,
‫just delete the thing.
‫And here you go, it just deletes the thing.
‫Okay, so just bear that in mind.
‫rm -r, rm -rf.
‫So let me go back to documents.
‫As you can see, notes.txt is over here
‫because we have just deleted the copy of it.
‫So let me try and move.
‫Move takes in the arguments exactly like in the copy.
‫So I wanna move that to test2 this time.
‫And here you go. It worked.
‫So I want to move, notes.txt to test2.
‫And as you can see, when I write ls I cannot see it.
‫But if I go to test2, I can see it, okay.
‫That's the difference between moving and copying.
‫So moving is like cutting and pasting.
‫Copying is like copying and pasting.
‫Okay, just bear that in mind.
‫And again, we are doing all of this stuff
‫in order to get familiarized with the terminal.
‫Great, now we started to learn something.
‫I believe we can stop here and continue within the next one.