Placeholder Image

Subtitles section Play video

  • please go to the line the computer guy dot com in order to view schematics, code and Maur for the projects that you are learning about.

  • Welcome back.

  • So today is a video.

  • I'm going to show you how to do basic folder management within Lennox.

  • So I've already shown you how to do things such as Rename copy and delete files within Lennox at the command line.

  • And now I'm going to show you how to do that with folders Maur or less again.

  • This is one of the things you always have to say in Lenox Maur or less.

  • It's the same as what you were doing with files, but it can be a little bit different.

  • Eso one of the things If you're going to be making a folder or making a directory, you use the make Directory command in K d.

  • I.

  • R.

  • Command.

  • So that is how we're going to be able to make a directories but then passed that when we start interacting with those directories and we're going to be doing things like copy, you know, when we're going to be doing things like deleting directories and folders.

  • One of the things that we have to do is we also have to add what is called the recursive argument or option.

  • So hyphen R That's what hyphen R does.

  • It says, Do this to the folder and everything else within the folder.

  • So this is one of those important things that you may get confused about, especially if you're coming from the Windows world and the Windows world.

  • If you're going to leave something, you know, he just right click delete.

  • And if it's a folder and just deletes the holder may ask you yes or no, but it just it leads the folder here.

  • One of things that you have to do is you have to add that hyphen R option there on that is what is called a recursive.

  • And so it will do.

  • It will do the operation not only to the folder that you're specifying, but also everything within in that folder.

  • So you will see recursive quite a bit in the Lenox world when we started dealing with things like file and folder permissions, right?

  • If we're gonna be changing permissions for a folder when the questions is, do you want to just do it to the floor itself.

  • You won't do it to the files underneath.

  • That's times that recursive comes up.

  • And so recursive is a concept that you should keep in mind because you will see it later.

  • One of things we also are going to be using is the F hyphen F force argument option, at least for remove.

  • And we're going to use that to force the system to delete everything within the force.

  • And we do our m do hyphen r f recursive force, and then whatever the folder is on, one of the reasons you use the force command is sometimes of their reasons within the operating system where the operating system doesn't want to delete, Let's say a specific file that is in a folder on.

  • So if you don't give the force commander, then it will fail out by saying force, you're saying do it.

  • I told you to do it, and you will do it s so you do use the Force Force option.

  • Now again, when you get Maur Advanced and Lennox administration, you may want to leave that F auction out when you're using the remove command just to make sure you don't do something stupid But in the beginning, Hey, you're gonna be doing a lot of stupid.

  • You might as well make your life easier when you're doing stupid things to say when that force that forest option Well, basically thank your life a lot easier.

  • We're trying to delete stuff so that let's go over what?

  • I'm gonna show you how to do today.

  • So I'm sure you gotta make a directory.

  • I'm going to show you how to move and and rename a directory.

  • So just like with files were used, The move command, The move man is both to move a file or if older, but it's also to rename a file folder.

  • Uh, then we're going to show you how to do a copy command on.

  • Then I'm going to show you how to remove the directory totally using again hyphen R f option there.

  • So with that, let's go over the computer and I can show you how this works.

  • So here we are, at my basic monthly server that I have running within a virtual box with 1 to 18.4 point three.

  • Lt s now all the commands that I show you today should work on any distribution of Lennox that you're using, You always have to say should.

  • It's Lennox, it's Lennox.

  • But anyway, let's law again.

  • So I would use her name of Bub, Have a password of 123456 And there we go.

  • We're now logged.

  • It will clear the screen, so it's easier to see.

  • The first thing that I'm going to do is I'm going to use that P a W D command that is going to show us what folder we are.

  • We're in the Baba folder in the home boulder in the root directory.

  • I'm then going to do a list command.

  • You see what files and folders are within at this Bob folder, and I can see I have a folder here called for.

  • So folders are color blue when you're dealing with the command line generally within you.

  • But so I know I have that folder.

  • So the first thing that I'm going to do here is I'm going to make a new directories are gonna make a new folder.

  • In order to do that, you just simply use the m k D I R command.

  • So make directory, and then whatever you wanna call it, So we're gonna call it new folder.

  • Make directory.

  • New folder.

  • That is literally it.

  • I had dinner with you.

  • L s to list the items within this folder.

  • And we can now see that we have the folder as we have before.

  • And now we have new a folder.

  • So now what I want to do is I want to re name New Ford.

  • Right?

  • So we talked about how to rename folders before, Basically, we're gonna be using the in the command it just like we would with files.

  • All you do here is you m V the original file or a folder that we're dealing with.

  • So move new folder, new folder, and we're gonna get to a new name New folder, too.

  • So, for example, so we're going to basically simply became in the name of new folder to be new folder too.

  • We're going to hit inner.

  • We then do l s list the items in the folder.

  • And so now we can see that it is now called New Ford or two.

  • That's pretty simple right there.

  • Right.

  • Let me do the move Command again.

  • So rename it back to what it waas a new folder to back to new folder Ener let us and we can see that we now have a new border.

  • So that's all that you have to do in order to be able to re you name a folder or directory with Lennox.

  • So now let's clear the screen again.

  • And so one of things I want to do now is I actually want to put a file into this folder called New Folder so that when we start moving the fooling around, we're copying it.

  • You can see what happens when there is actually something within that that that folder, eh?

  • So what I'm going to do is I'm going to change directory and two new folder.

  • So we're now within a new folder.

  • I'm going to use them again.

  • Them is the file editor I like to use use whatever the hell you want is.

  • Apparently this is a huge argument.

  • I like them.

  • You use whatever you want, so I'm going to use them to create a file called Test File.

  • So vim space, whatever.

  • Hell you want the file to be.

  • It's going to be created within this folder I hit.

  • Enter I will then simply do colon w Q.

  • So what Colin does Colon gets you into the command prompt for them.

  • So it allows you to start being able to give commands to them.

  • Uh, w is right, as in Save, and Q is quick.

  • So basically, what this says is saving quit because all I want is for this file will be created.

  • I hit inner I know do.

  • L s and I can see with any new voter is there There is a file called test file so that I'm going to do seedy space period, period.

  • So we do change directory space, period, period.

  • What that does is that takes you up one level, so it's gonna take you up one level in the file structure.

  • Uh, I'm going to clear the screen again so we can clear the screen.

  • I do.

  • L s And so we can see we've got the folder and we've got the new folder here.

  • So what I want to do now is I'm actually going to move new folder with the test file into the folder called for probably working my naming conventions here.

  • It's I may not have the best name.

  • So we're going to use that move command, because again, envy, move, command.

  • And so we're gonna do is write a new folder.

  • So we're here.

  • So basically, we do move space and then the folder that we're dealing with, and so you have to put the whole file path.

  • So since I'm in this folder and I can access New Fuller by just typing new folder, that's that's all I have to do to basically move space new folder space, and then where am I gonna move it too?

  • So what I want to do is I want to move new folder into folder into four.

  • So to do that folder forward slash new folder.

  • So what I'm doing is from where I'm at in the file structure, I'm saying go into folder and then move new folder into that folder hopeful when the important things, though to remember here is remember that move Command is both a move command, actually moving a file and also your renaming command.

  • So be very careful here, because if you if you type the wrong thing, if you fat finger it, it's gonna come out with the wrong name.

  • So let me just do that right?

  • Let's let's just do full right.

  • Let me just completely screw up.

  • So move new folder or in the fold or forwards last new foe.

  • So it's gonna move, and it's also going to read a enter right.

  • We don't get any errors.

  • We don't get any problems.

  • We do.

  • L s we can see now we only have folder and new folder is gone Change directory and new folder.

  • Then let's do l s again and we have new foe, right?

  • There's gonna be a really big problem again if that folder has configuration files in it and that's important for the server and order to do whatever the hell it's doing.

  • That is a really easy, easy, easy, easy way to crash your server.

  • So what?

  • I'm going to do it and I do move M v new foe.

  • So that's currently what the name of it is.

  • Space and the Morrigan simply going to call it new folder s.

  • So we're gonna basically rename new photo folder.

  • Then we're going to l s on.

  • Now.

  • We got new folder just to make sure the files and all that move, you will notice we didn't have to reuse a recursive command for move.

  • It simply moved everything for us.

  • New CD, new folder, candy directory into the new folder that we do l s.

  • And we can see our test file is still there s o c d space period, period.

  • That's gonna take us up one level in the file structure again.

  • S So we're now currently in the folder.

  • Let me clear this to make it easier to see.

  • And now what we're going to do is we're going to copy the folder, so we're going to create a copy, right?

  • Eso Let's do I want to show you what happens if you don't use the recursive.

  • So notice notice.

  • When I moved in the folder, I did not have to use the recursive argument.

  • Didn't have to use the recursive option, but if I do copies of sea PCP is copy someone a copy.

  • New folder, too.

  • It's a new folder back.

  • All right, just create a backup file again.

  • That's an important thing before he starts screwing around with in an operating system.

  • Especially if that server matters, especially if it's a production server.

  • Back everything up before you touch anything.

  • Bank it up.

  • So we're gonna do here is we're gonna copy.

  • We're copying a new folder, and we're going to create a basically, just a backup folder called new folder dot back now, since there is a file within new folder when I hit enter.

  • What you get is you actually get a decent error here.

  • C p hyphen are not specified.

  • Omitting directory.

  • A new folder.

  • All right, so if we do, l s we can see that we still only have new folder.

  • Here's what I need to do with any new CP space hyphen R.

  • So this is recursive.

  • They were gonna say, new folder, What we're gonna be copying and the new folder B a k right.

  • So copy hyphen R recursive new voter.

  • This is what we're copying.

  • And this is the way we're gonna be naming the copy.

  • And then we hit enter, and it goes right through.

  • So do l ass from here.

  • We can see we now have new folder, and we have new folder dot back so that that's a good deal right there.

  • Okay, so let's say we go through Oh, we do.

  • All of our we don't do all the stuff that we're supposed to do.

  • Everything works.

  • How s so?

  • We need to get rid of the new folder dot back folder, right?

  • We no longer need the backup.

  • Everything's working properly.

  • Let's get rid of back up so we don't do something stupid.

  • So now we're going to do to remove command.

  • Basically, this is the way that we delete a folder.

  • Now I will show you again since new folder dot Back has a file on it.

  • So let's just go in there CD new, full dirt up back.

  • L s just to show you there is a test file in the new folder dot back folder.

  • Do Seedy space Pure three.

  • That takes us up one level.

  • Let me clear the screen again, eh?

  • So now I'm going to remove that new folder dot Back to do that to dilate you'd use the r M command used are in command.

  • Now, I'm not gonna get do any options or arguments here again just to show you the error.

  • Eso new folder dot back basically remove.

  • Be delete.

  • New folder dot back if I enter, cannot remove new new photo back is a directory, right?

  • So in order to be able to remove new folder dot back well, at least have to use the hyphen.

  • R, that recursive option.

  • I will also put in the f the force option.

  • It's because you can run into some issues.

  • Sometimes again, if a file is be used, especially the old large.

  • If you have a folder with a lot of stuff in it, some things maybe you being used by something maybe be used by service or something like that.

  • You may run into problems if you don't use the force option in order to delete the file.

  • So I normally just use hyphen R f You will have to decide once you become a fancy administrator, whether that's how you want to do things.

  • But you are m that I do hyphen r f so recursive force space a new folder back.

  • And then if I enter okay.

  • So I don't get it.

  • L s So now all we have is a new folder again.

  • So basically there, I showed you how to make her directory.

  • M k d i r.

  • So you have a copy?

  • A directory?

  • Sorry.

  • Every name a directory using the move.

  • Command and V, actually, do you have to actually move a directory using the M V Command?

  • I said you had a copy.

  • A directory on I show you how to Billy one.

  • That's really all there is to the basic and a folder management within Lennox.

  • So there you go.

  • There's basic folder management within Lennox.

  • 00 I'm sure I'm about to start hearing some clinics.

  • Administrator starts screaming.

  • I'm sure they're gonna start being really nasty with me, especially with me saying things like, just throw that little force option in there.

  • But again, I want you to understand here at the introductory level here to Lennox.

  • So I'm showing you how to do these things, these commands so that they actually work again.

  • It's important.

  • There is difference between learning commands and learning things and then actually doing them in the real world.

  • By the time you get to a production environment, you will understand a lot more of these things on.

  • Then you will be able to make your own decisions again.

  • Using using that force option for your level, I think is very good, I think will make your life a hell of a lot easier in the real production world.

  • That might be a little bit more careful with, Four said.

  • I really, really want to make sure I know exactly what I'm doing.

  • It is curious, though again when you start dealing with the Lenox world, seeing when you need options and arguments and when you don't again.

  • If you want a move a folder, you don't have to use recursive or anything else.

  • You don't have to use the hyphen.

  • R If you want a copy a folder, you do have these.

  • A hyphen are obviously, if you remove the fuller, you have to use the hyphen.

  • R.

  • So it's just it's like one of those things that gets a little frustrating because you think, Oh, I have to use this when I'm interacting with folders.

  • It's like Now is some commands, you d'oh!

  • And some commands you don't also the big thing again, especially when you are moving a folder.

  • Do you realize the move command and the renamed command are the exact same thing?

  • If you're fat, finger it if you ah view fat finger and important and folder that's that's required for the operation of your server that may be a dead server.

  • About everything's going right, because this is what will happen.

  • I can explain you what will happen.

  • You'll Ray name before you'll move a folder.

  • It'll get renamed by accident.

  • You'll plug that information somewhere into a script or something, and everything will be running along fine.

  • To be clear, everything will be running along fine, because if you have service is running, all the configuration files are already within memory.

  • They've already been loaded.

  • So when you screw up with the move and you re name something, all the configurations already reloaded.

  • And so the configuration files themselves aren't currently being used.

  • What happens, though, is when you restart service is or when you re boot the server.

  • Obviously, when you reboot that flushes the ram.

  • Then all of those service's go to look for the configuration files to figure out how they're supposed to configure themselves.

  • And when they go and you screwed up you fat finger the move.

  • Until you renamed the file or folder to something that is not supposed to be, they will not be able to find the file folder that they're looking for, so that means they will not be able to load their configurations, which will mean your server will go.

  • So that is one of those things.

  • Just you Really?

  • Seriously, keep in mind when you're moving and final sinfulness If there's one time you really gotta pay attention on Lenox World Really analytics world.

  • You always gotta pay attention to what is one time you're gonna you know, I'm saying, like, get the extra cup of coffee before you start moving files and folders.

  • Get an extra cup of coffee, drink it, make sure you really know what you're doing.

  • You can both move and rename a final or folder of the exact same time.

  • And that could just be all kinds of nastiness.

  • Now again, with all these commands where C p m v make directory R M, there are other options and arguments that you can use.

  • Obviously, Zago, do a Google search.

  • Take a look.

  • But our hyphen r recursive and hyphen f force are the basic ones that you will be using.

  • Uh, yeah, and that's really that's really all there is to it.

  • So, with that again, if you're gonna be playing with this, I would say it would say clone.

  • If you create a virtual machine, clone the virtual machine and then play around with this on a clone virtual machine just so you don't have to re in selling operating system when you screw something up When went so so So there you go.

  • As always, I enjoyed doing this video and look forward to the next one.

please go to the line the computer guy dot com in order to view schematics, code and Maur for the projects that you are learning about.

Subtitles and vocabulary

Click the word to look it up Click the word to find further inforamtion about it