I know guys welcome to the next video on Linux command line to troll for beginners and in this video we will see how we can use MV command in Linux so let's get started I will just press ctrl alt T to open my terminal and you can see on my desktop I have a directory and a file right so first of all I will browse to my directory using CD command and press enter and I can LS here and I can see I have directory 1 and file 1 now to use MB c'mon we have this option so you use MV command with some options and then you have a source and then a destination ok so first you use MV as a command then you can use options like - V or - I or - F then comes your source file it can be one or many files or directories and then comes the destination file or directory ok so let's see how we can use it so first of all I have this file 1 and I want to use MV command to change the name of this file for example so I will just use MV and then the name of the file and then I will just give some other name to the file for example file 2 dot txt ok and press enter and you will see here this file becomes file - ok and the content of the file will remain the same so I can use cat cat command - you know display the content of the file so just use cat and I have this you know content in my file 1 which is also transferred to the file 2 now for example I want to create a new file and move the content of file 2 to file you know 3 for example and I want to just you know transfer all the content of file to to file three so I can just use MV and then file to which is a source and then I can just write file three dot txt here and press enter and you will observe here that file 2 is gone now and file 3 is created and the content of the file we can check is the same as file 2 because it has changed the name of the file and moved the content of the file to file 3 so if the file doesn't really exist then it's going to create the file the simple you know formula of this now for example I want to move for this file 3 to direct G 1 I can just use MV and then on the file name and then my directory name right now for example I will just open this directory and you can see here file 2 is already there and I'm going to transfer file 3 also there right so I will just press Enter MV and the file name and the destination name and then I will LS directory 1 and let's see the content of it and you can see now it has file - and file 3 both ok so in this way you can transfer the file or move the file to our directory using the move command ok now for example I will create a new file for example file 3 once again so I will just say file 3 dot txt and this is a new file I want to create on the desktop and that content for example will be some random text here ok and I will just press control D to end the file so this is file 3 and I want to move this file to directory 1 which already have file 3 so let's see what happens now this file 3 new file contains random next and the old file which is in the directory tree contains this kind of text I can show you this kind of text right so now what I want is I want to transfer this file three to the directory one so I can just use MV and then I can use the name of the file and once again what I have done is I've given the destination with name which is directory one right now let me open the directory one and we will see what happens and the result of it so I will just press ENTER and it will move the content of file three which is on the desktop to the directory one and what happens here is it will overwrite so the file three which was there on the desktop is you know overwritten and this file in the directory one is overwritten by the desktop file three okay so I can just cat there one file three for example and the content will be the random content which we have given which is the new file three which we have created right so if you want to you know move the file which already exists then it will overwrite the file okay so for example once again let's see an example but this time what we are going to do is we are going to you know do it with the some command so first of all I will create once again file three and this time I will once again give some random text here and press control D and this time instead of using this command like this I will use a flag I and flag I or minus I stands for interactive mode so it will ask you if you want to overwrite the file which was already present in the directory one with the same name so I'm going to just press ENTER and you can see it will ask me if I want to overwrite and when I press Y and press Enter is going to overwrite the file or if I have press N and press Enter it's not going to overwrite the file which was already there in directory 1 right so I will press N and it will not overwrite ok let me clear the terminal now let's create our directory okay so what I'm going to do is I will just use mkdir command which we have learned in the previous video and I will create a directory - for example oops the command was wrong it was mkdir not Mak dir ok I was going to create this directory - right now for example I want to transfer the directory inside the directory - so for example I want to transfer the directory one inside directory - I can use the Move command so I can just write directory 1 and V directory one which is my source and I want to move it inside directory - so I can just write the destination name which is directly - and by the way type 2 2 is right now empty you can see there is no content inside this and when I press this command and press Enter is going to move directly one inside directly - so we can just LS inside the directory - and you can see directory 1 is there and inside directly 1 there was some file right so I can just write directly 1 directly - and inside that I have directly 1 and I can Alice the you know files inside the directory 1 like this and you can see the content is also moved with the directory ok so you can you know move the directory and its content using MV command also now let's see what happens the directory which we you know want to move this directory to doesn't really exist right so I will just use MV and I will just write directed to and I will I want to create a new directory and move the content to this directory tree right so when you do this press enter the name of the directory is changed and content is moved to this directory tree and the directory to is you know disappearing right so if the directory doesn't exist it's going to create a directory and then move the content of the directory inside directory 3 so it will not move the directly true inside directory tree but the content of directory to inside directory tree so you can see there is no directory - inside directory tree it's going to create the directory and you can say it's like renaming the directory if the directory doesn't really exist and if the directory already exists then it's going to transfer directly to inside directory 3 ok so I hope you understood the this basic concept which I want to convey here right now there are many command which we are you know can use for example mb - me for verbose and for example once again i want to transfer the file 3 to the directory so i will just give the directory name and press enter and gives you you know though you know explanation what this command has done so it has moved this file 3 to the directory 3 right and it has overwritten this thing right and there are many commands and this command you can you know know by using this command which say which is man and then MV command ok so just write man and mb and it's going to key view the whole you know description of using MV command right so you can use - be with MV command or - F with FB command I we have already seen and these are the description of all the flags and you know options you have with MV command so just use this and you know read these descriptions and you will be good to go so I hope you have enjoyed this video please rate comment subscribe and bye for now
Video Description: Linux Command Line Tutorial For Beginners 9 - mv command for Software Development 2023 is part of Complete Linux Course: Become a Linux Professional preparation.
The notes and questions for Linux Command Line Tutorial For Beginners 9 - mv command have been prepared according to the Software Development exam syllabus.
Information about Linux Command Line Tutorial For Beginners 9 - mv command covers all important topics for Software Development 2023 Exam.
Find important definitions, questions, notes, meanings, examples, exercises and tests below for Linux Command Line Tutorial For Beginners 9 - mv command.
Video Lecture & Questions for Linux Command Line Tutorial For Beginners 9 - mv command Video Lecture | Complete Linux Course: Become a Linux Professional - Software Development - Software Development full syllabus preparation | Free video for Software Development exam to prepare for Complete Linux Course: Become a Linux Professional.
Information about Linux Command Line Tutorial For Beginners 9 - mv command
Here you can find the meaning of Linux Command Line Tutorial For Beginners 9 - mv command defined & explained in the simplest way possible.
Besides explaining types of Linux Command Line Tutorial For Beginners 9 - mv command theory, EduRev gives you an ample number of questions to practice Linux Command Line Tutorial For Beginners 9 - mv command tests,
examples and also practice Software Development tests.