Raspberry Pi Linux LESSON 7: Using the Wildcard

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys I am Palma quarter with top tech boy calm and we are here with lesson number seven and we are learning the raspberry pi and we are learning how to use the terminal window and the command line on the Raspberry Pi in Linux and so hopefully you've been with us through the first six lessons and if you've been through with us through the first six lessons you've learned where you can get your equipment the things that you'll need in order to follow along in these lessons in lesson number two we showed you how to install the operating system and get the system booted up and then lessons three through six we're pretty much just going in and learning how to manipulate files copy files create files move files edit files sort of find our way around the OL Linux system using the command-line and not using a graphical user interface well today we're going to learn some some little tricks when that'll make your file management a little bit easier when we learn something called the wild card okay yeah we're gonna learn the wild card today all right well let's see where we are first of all I am going to have to get my window going here so if I come up PWD I am in my home PI folder so you want to kind of go ahead and go there if you look at what's in that folder you can see that I've gotten rid of all the stuff that we created in the past and so I think that we want going to want to make a directory here so you'll say make directory and I'm going to call it my ah stuff okay nice stuff all right now if I do an LS I have a folder called my stuff to make the paths easier I'm just going to go ahead down into AI stuff okay now since I'm there I'm going to create a file called I I'm going to feed a file nano and I'm going to call it dog one dot txt okay and when I come here my first dog was named spook he was a big Belgium shut bird he was a good dog okay see he was a he was a big Belgium shut heard he was a good thought okay he got run over a propane truck driven by slim Green true story very sad day okay so let's write that so we do a control oh the name that you want to write to yes dog one dot text and then we're going to exit out this okay and then we exit out okay we do an LS and there is dogs dog one we do a cat dog one dot txt you know I want you to learn this stuff so I know some of this is repetitive from earlier lessons I'm I'm just trying to remind you and this is just good practice okay let's make a new one let's say nano dog - you can write this for your own dogs a little tribute to the dogs of your life maybe okay nano dog to my second dog was Susie she she was a German Shepherd she would chase sheep and run away and my dad did not black her and said she was a stupid dog okay I miss being honest with you my dad did not like Susie and soon as he was always getting in trouble chasing sheep which would make my dad very mad okay so we're going to save that so we say control oh we're going to hit enter to save it and then we're going to go control X now if I do an LS I've got two things okay now let's say I'm going to say dog three I'm trying to get some files put together here plus this is good practice for you okay so I'm going to go nan-oh I'm going to say dog three txt okay my third dog was spook spook number two we found her on the highway my dad said she could come home as long as she lived lived outside she would walk around the house staring in the windows and finally my dad gave in and let her become a house dog my dad loved spook number two more than any other dog okay true story all right so we're going to go control oh we're going to write out dog three and then we're going to control X okay let's do nano dog four dot txt okay my fourth dog was little sweet she was a nice little Shih Tzu I don't know how she fell sheets it for sure okay she got run over in aa 2006 it was it was a very sad day okay control Oh to write out inner control X we do an LS look I got one two three four okay I'm going to do do one more okay alright so I'm going to do Nano and I'm going to do dog five dot txt and my fifth dog was little Elma every born loved little Elmo I threw some old scraps out in the garden and little Elmo ate em and died I guess I should say ate them and got sick and died the whole family blamed me for the dog's death true story ok control Oh control in I mean control Oh X or control Oh enter in now control X ok let's look at what we have in my stuff I've got five fouls dogs 1 dogs two dogs three dogs four dogs five okay let's go to nano cats dot txt all right I do not like cats I do not have cats I think cats are evil and I will not allow cats at my house ok control o enter control X ok LS we're going to do one more we're going to do nano carts ok dot txt okay I like i Nissan 3 I don't know if it's a 300 or a 350z it's a little Nissan convertible ok I don't drive it much because I fear hitting a gear and the gear de are in yet I live about 20 miles from where I teach and I come in very early morning when it's dark and there's a lot of deer in the road so I Drive a pickup I Drive a pickup to work ok control Oh - right enter control X now LS look ok so now I have cars cats dogs one dogs two dogs three dogs four okay well look at this I'm starting to get a lot of fouls in the stuff called my stuff and so I think it would be better if I created a new directory so I'm going to say make directory and I wanted it the same level as my stuff but I want to call it my dogs I want a new directory called my dogs and so if I want to create it from here but I want it to be at the same level inside of home dot PI what would I do well I would need to say go up one that would take me to home slash PI and then there make it my dog's okay let's look now let's do an LS dot dot slash my underscore dogs okay and there's nothing in it let's do a let's do an LS up one and that shows me that I've got two new foot I've got two new folder so I've got my dog's folder I got my stuff folder okay what's my problem I've got all my dogs in my stuff folder and that's probably good because my dogs are my stuff but probably what I should do is I would really like to have those over here in my dog so how can I do that well I could do a move okay and I could move dog 1 okay let's see where I am right now LS okay I'm in there with them so I could say move and then remember I've got to give the path and the filename so I could say move uh I'm in the current folder so I could just say dog 1 dot txt and I want to move it up one and then down to uh my dog's like that okay now the problem with this I mean this would work and then I could do and then you know it would put it there and then I could do it and I could do it again and I could do it again and I could do it again but if I did it this way I would have to do this five times and so you can see that eventually it would take a long time to get everything over there and so what I'm going to do instead is I'm going to show you a little trick instead of dog one dot txt and see dog and then I'm going to put in the wild-card which is the star dog star dot txt and so what that's going to do is it's going to find the word dog and then anything dot txt and so this would move any file called dog one dog two dogs three dogs four dog five dog X dog 1 million three hundred forty six thousand dog any string dot txt and so this means anything okay so I'm going to move dog star dot txt and where am I going to move it I'm going to go up one and then I'm going to go to my underscore dogs and that should move them all at once if I did this right okay so move dog anything dot txt the wild-card and then move it up one and then down into my dogs and let's see if that works okay now let's go LS we're still in my stuff so I don't got dot and then I'll go my dogs and look at that look at that boom there are all my dogs let's do LS where I am and what am I left with cats and cars because that's the only thing that was that was the only thing that was left there I moved everything all at once okay let's move them back I can say move I can say move well here what I could do is I could just move them all I could say move star dot txt I don't even have to put dogs let's see I'd have to go back and tell it where am I PWD I'm in my stuff and so I could go I women PWD I'm in home PI my stuff and so what I would do is I would say move and I want to go back to dogs so I goes dot dot slash my dogs and then get the files star dot T X T and then move them to where I am now so this should move them back ok I got to give it a got to give it a directory okay so let me let me go over there first because that would that would make it easier so I'm going to change directories and I'm going to go to dot dot slash my dog's okay now LS okay there's all my dog stuff so now I'm going to move those I don't have to give it path because I'm in the folder and I'm going to say star dot txt and I'm going to move them where I'm going to go up one and then back to my stuff let's see if that does it okay you got a mosquito here get out of here okay now I'm going to do aa LS and I want to LS dot dot slash my stuff okay and look everything is back over there now okay everything is back in my stuff if I do LS my dogs there is nothing there okay what if this time I want to uh let's just say that I was going to create a Python program and I'll show you how to do pie on programs later but let's say that I am going to just say nano and I'm going to go dot dot slash my stuff and then I'm going to go program dot pot so I'm going to create something with a dot pi okay and then I want to say ah rent hello I guess I put quotes hello world okay now I'm going to control o control X inner control that's okay what if I could actually run that Python dot dot stuff slash program pi I wonder if I could run that look at that I ran the program hello world okay you just saw how to run a Python program okay but now let's go back to change directory dot dot let's go to the my stuff folder okay let's do an LS and ah let's see I need to make this where you can see it I'm kind of running off the side of the screen wondering I should pull this then and then maybe you'll be able to maybe it'll wrap around hopefully this will wrap around if I pull it over here okay let's try that again okay yeah so now I got it wrapping around okay so if you look at this I am now in ah I need to pull this back like that okay so now let's do an LS and you can see that in my stuff I've got cars dot txt dog one dot txt dog three text dog five dot txt cats text dog to text for and program pi okay what if I wanted to move everything let's let's create another stuff on on make directory and I want to make her correctly I want to go up one and after I go up one I want to call it text text files okay so now let's do LS there still there let's do LS dot dot look up one and what I've got is my dogs my stuff and text files okay now in text files what I'm going to do is I am going to try to move all my text files into the folder called text files and so let's see where I am now I'm there let me make a little harder so I'm going to go change directory dot okay so now I am up here in desktop I'm up here in home - PI or home slash PI and so now what I want to do is I want to move all those text files from my stuff to text files so I am going to say move and then what do I want to move well I would want to move anything start dot txt I would want to move anything but I got to tell it where so I got to move my stuff /e star dot txt and where do I want to move it I want to move it to text house okay like that now just to reminder here why am I not using a leading slash that leading slash would take me back to root right I don't want to go to root I want to stay reference from where I am so I'm going to move my stuff start up text that should take all those text files and it should move them to textiles if I've done this right so let's see what happens okay let's do an LS text files okay and if I look in there look at that there are all the type of text files if I do LS my stuff look in there looky there I got nothing but my Python program okay so what you can see is is that this is a very very powerful way to move things around and this wild card can also be used you know like I could say let's say move a star dot star and move star dot star from I gotta tell it where let's say my stuff okay slash star dot star and then where do I want to move it I want to move it to my I'm going to move it which is say to text owls okay and if I do that now do an LS okay I do an LS in text files and then what you can see is it move the the program dot PI because star was anything dot anything so it's going to move everything so let's just move everything back in one command so I'm going to say move okay and I'm going to put this is my stuff and then slash star dot star start out star and then I'm going to move it to our women this is in this is in text files going to move text files slash star dot star and where am I going to move it I am going to move it to my stuff let's look at that now LS my stuff and look it's all there LS text house and there is nothing there okay so you see if you use this one Allart is very powerful and it's very easy to move a whole lot and we could also use it to oh let me copy it so I'm going to say I'm going to say copy this time uh let's see I am and all the stuff is in my stuff so I'm going to copy my stuff dot my stuff slash star dot star move everything or copy everything to text files like that and now let's look at LS text files and their everything is okay now in text files let's say that in text files I don't want that program dot PI and so what I could say is remove and then I could say text files and then I want to remove star dot pi remove all the programs from there okay and now if I do an LS text files I have I've gotten rid of that Python program okay now let's look at my stuff so I'm going to change I'm going to go into LS my stuff and in my stuff I've got everything well I want to room the text file so I'm going to say RM I'm going to put star key XT and then oh I'm sorry RM and then I've got to go to my stuff and then start T XT and now let's look at that now let's look at LS all right stuff okay and all I have left is program dot pi because I got rid of all the text files but I did copy them over there so they should still be LS in ah be my in text files and look there they all are okay so you see this this this star this this this wild card can be used for you know in any of your commands as far as the as far as the line X goes you could use it in mu move you could use it in copy you can use it in remove you can use it in remove directory you could use it in a lot of the different things that we have here and so I what I want you to do is I just want you to sort of become familiar with this and I know some of this stuff in this lesson was repetitive but I just want you to get really comfortable with using with using the Linux command line and using these path names hopefully you're you're sort of getting to understand that dot dot means up one if you do a slash that means go all the way back to the root if you don't put a slash then that means go relative to where you are now if you can kind of start getting that done you can really start doing things very easily but you can see when you get good at this this is easier than opening folders selecting things dragging and dropping moving and all that sort of stuff cutting and pasting you can see that you can really do things very good it also shows you that you need to have some discipline when you're naming your files that by putting the dot txt extension on txt files then you can deal with them as a group by putting dot py Pro extensions on Python programs you can deal with them as a group and so and so you can see that using some discipline in naming your files is really good ok so we've learned how to use the wild card today and this has been lesson number seven hopefully you'll tune in very shortly for lesson number eight Palmer quarter top tech boy comm we will see you shortly if you liked this think about giving us a thumbs up talk to you guys later
Info
Channel: Paul McWhorter
Views: 30,961
Rating: undefined out of 5
Keywords: Raspberry Pi, Linux, Wildcard, Command Line, Terminal Window
Id: tXKO_Z2S0vk
Channel Id: undefined
Length: 25min 43sec (1543 seconds)
Published: Tue May 26 2015
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.