Placeholder Image

字幕列表 影片播放

  • 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 in today's video, I'm going to show you how to use the where is command and the fine command in order to try to do things like find the configuration files for the applications that you install on your server.

  • So you now know how to use apt hyphen.

  • Get in stone to be able to install Apache to install PHP dot i and I file.

  • And so you're all excited, right?

  • You can solve the operating system, you can install software.

  • Great.

  • Now you have a server.

  • But why doesn't the server do anything?

  • It doesn't do anything because you haven't gone in and modified the configuration files.

  • But here's a problem.

  • Here's a problem.

  • Insulin.

  • It's world Ln ex oil, right?

  • You already know how to use them, right?

  • You're like, Well, I know how to use them.

  • And so all I have to do is get to the files and I'll use vim The modify that the configuration files.

  • But the problem is of Lennox World is you have no idea where that hell the configuration files are.

  • And again, that is one of those big issues you run into with Lennox, where literally everything that you do with Lennox.

  • You either know how to do it or where things are or you don't in your kind of screwed.

  • So the where is and the fine commands could be very useful because these can try to show you where the files you're looking for are so that then you can use them to go in there and configure them again.

  • This is the important thing to understand.

  • With Lennox, right?

  • Ik individual component of Lennox is idiotically simple, right?

  • Installing Lennox is simple of them, Miss simple navigation is simple.

  • All of this stuff and stolen applications is ridiculously simple.

  • The problem that you get to it put in all the things together into a server that it actually does something that you need that's where it all again or like, just falls off a cliff s o again using the where is command and the fine command can make your life easier for trying to do things like find the PHP dot I and I file so the first command I'll show you.

  • Today is something called The wear is command.

  • So for this command, all you do is you simply say, where is all one word?

  • No spaces.

  • Where is and then a space?

  • And then whatever application you're looking for somewhere is a patch.

  • You too.

  • Where is PHP?

  • Where is fine if you want to do it.

  • And what this does is it shows you the folders where the configuration files and other files are stored for that particular application.

  • So this could be very useful again when you're getting used to Apache or PHP Or let's say just so, some other random ass application that you install in here onto your clinic server and you're sitting there and you literally just simply don't know where the folders are that that contained the information for this particular program you do.

  • Where is space?

  • Whatever the name of that particular application, as you use the exact same name that you use in order to install the app or to uninstall Leah or to restart the service's that's the name that you use and basically will show you the folders.

  • And so that's one of the ways that you can try to figure out things like what the configuration files are.

  • So hopefully you can simply use Google.

  • I can't.

  • Anna Lennox, World screw man pages, man pages.

  • That's also 2001.

  • In the real world, you use Google, but normally you go to Google and you try to figure and you could go to Google when you can figure out what the configuration files and that type of thing are.

  • But sometimes again, maybe it's a custom piece of software.

  • Maybe something weird.

  • Maybe you don't have the ability to get to Google for whatever reason.

  • Um, by being able to do where is and pull up all the folders where the configuration files and everything for the application are stored, you can then navigate to those folders and do a list command.

  • See what shows up go.

  • Oh, okay.

  • That's probably what the configuration file isn't that you've been trying to go edit it that way, s so that's what the where is command is relatively simple.

  • It's not.

  • You're not gonna use it every day.

  • You're not gonna probably not even gonna use it every month.

  • But simply knowing that the where is command is there will probably save your butt at least once a year.

  • The important command that we're gonna be using today is fine.

  • It's very simple.

  • Find command.

  • And so fine is a basic search command and Lennox.

  • But of course, being Lennox, you get a lot of options.

  • You get a lot of functionality, which is good, but if you don't know how to use them, they can be a pain in the butt.

  • So one of the first things that will say with the final command as if you're going to be searching from the root So from system route one of things that you want to do it finds you want to use Su Su super User.

  • D'oh!

  • The reason being again, one of the interesting things with five is you can navigate the route you can plug in the fine command.

  • But curiously enough, when the find is going through, the final grand is going through.

  • Actually, look for whatever it is you're looking for you as a normal user, even as the person who installed the operating system, the route, account or whatever, I don't actually have permission to get into a lot of the folders.

  • So if you simply do find you no hyphen name and then whatever name you're looking for and you do that from room and you do not you suit you will get lots and lots of lots of failures that we get very confused.

  • I get very confusing, a very frustrating And then you want to go off on your floors.

  • Curiously enough, all you have to do is you just plug in soo do fine space hyphen.

  • Name my name.

  • Whatever else on, then Whatever the name is you're looking for that will actually be able to go into all of the directories, find whatever it is you're looking for work and spit it out for you.

  • So the first thing to think about is if you put find whatever it is because we're gonna show you name and I name user and cement.

  • Today, I'm gonna show you a couple of arguments.

  • You can put it there.

  • Basically, if you plug that end and you get out a whole bunch of garbage.

  • I just realized you might want to try suit.

  • Try Sue knew before you give up.

  • So that's when the important weird quirks when it comes to the find in the Lenox Road the next.

  • The next thing to be thinking about is again Remember, in the Lenox World, capitalization matters, capitalization matters.

  • So you're gonna put in, find on, then you're gonna put in hyphen, and you're gonna use a name or I name to find the name of a file.

  • Here's the important difference between the arguments name and my name.

  • If you put in name, then that means it's ah, capital sensitive.

  • It's a case of case sensitive.

  • Right?

  • So lower case T t e s t dot t x t is different than uppercase.

  • T e s t t x t Right.

  • So if you put find hyphen name and then a single quotation mark on, then lower case t e s dot t x t close quotation mark in the hit Enter then it will only look for lower case T e s t not t X t.

  • If you have uppercase t e s t t X t, it will not find it because remember, that is a different case matters in the Lenox world.

  • So if you care about case, if you care about case you use the eye name argument so fine.

  • Hyphen I name and then single quotation Mark.

  • Lower case T E s T T X t closed lower quotation mark.

  • And if you do that, it will give you lower case T s t s t not the extinct.

  • I will give you uppercase d e s t t X t It'll give you everything that is spelled t s t dot t x t capitalization will not matter.

  • So that is one thing to be thinking about analytics world.

  • A name is case sensitive.

  • I name is not case sensitive.

  • So generally, how does use I name Unless you really know what you're looking for.

  • Just just that extra eye on there.

  • It will make your life a lot easier when the other things to remember is ah, when you're doing things like fine in the Lenox world thing asterisks is the star is a wild card, eh?

  • So let's say I'm looking for I'm not.

  • Let's say I'm not sure what the PHP configuration file is.

  • PHP die.

  • Let's say for some reason I don't know that.

  • So I could literally put it, uh, find hyphen.

  • I name a single quotation mark PHP star close single question mark.

  • And then what that will do is it will go through and it will look for everything that starts with P H P and then ends with literally anything else.

  • And so all of that will pop s Oh, that's one of things I think about.

  • Remember, the star of the asteroid is a wild card, so you could put that in front so you could put a single quotation marks star PHP close single British market.

  • Now it's basically that would be anything that ends with Ph.

  • B.

  • So you might look for I and II files, right?

  • You might say, I want to know all the eye and I files on it limits machine so I could do find hyphen, high name single quotation marks star at dot I and I know what that would do is I would find anything that ends in dot i and I.

  • So that's one of those things that you could be thinking about is to use the wild card one.

  • The other things you can use the arguments.

  • If you're looking into four files that are owned by a particular user, this might be valuable for you is you can actually use the hyphen user arguments of your new hyphen user.

  • Single quotation.

  • Mark it Whatever the user name is.

  • Close single quotation mark that will show you the files that are owned by that user.

  • So that might be valuable to you if you have multiple users and really not even just multiple users.

  • But, like if you have different service is and you've created users for that service is and you're trying to figure out what files the service's air using, that's only you could do a user and then another.

  • One of the interesting things you can do is you can actually searched by what files have been modified in the last X number of minutes.

  • So you can do hyphen, semen, hyphen, semen, C, C, C m i n space hyphen.

  • And then however many minutes and then that will show you the files and folders are the files that have been modified in that number of minutes.

  • So if you're going through when you're trying to see oh, you know, like, let's say you're editing right, you're sitting there, you're editing all these files and then you go crap.

  • I screwed up one of those files, but you forget which file you're like.

  • One of those I screwed up and I and I file I'm not sure which one it wants.

  • Well, you could do is you know, you've been working on your computer for the past 20 minutes.

  • You could do a hyphen, the semen hyphen 20.

  • And then we'll show you the files that have been modified in the past 20 minutes.

  • And they go, Oh, yeah, it's that one.

  • So those were some of the functionality that's very useful.

  • Using fine again with Lennox Lennox.

  • There's a whole bunch of other options.

  • There's 1000 other things that you can use find you could do a lot of amazing stuff.

  • I'm going to show you these couple of things just because I think they're the most relevant for you.

  • They're the easiest, understand?

  • And once you understand them, then by all means go to the man page and see all of this stuff that you can D'oh!

  • One of things I try to do with all these classes is basically just show you the smallest subset possible to make you feel comfortable with what you're doing and then you could go get go to man paid isn't figure out to figure out everything else.

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

  • So here we are, my Avanti server.

  • Again, this is simply a virtual machine within virtual box.

  • Eso, whatever your host upper and system is, whether his Windows, Lennox or Mac.

  • If you're using virtual box and you insult Avanti server, you should be in the exact same environment.

  • Eso with this.

  • Let's just for a second ago.

  • And make sure we know where we are in the operating system in the folder structures.

  • D p W d.

  • Command it inner.

  • So we know we're in the Bob folder in the home, a folder in the system route.

  • The first thing I'm going to show you is how to use the where is command.

  • And again all the where is command does is show you the folders that contain the files for whatever piece of software that you're interested in.

  • So I simply could do where is space and then whatever I'm looking for, So I I install a PHP onto the server, so I can say Where is PHP?

  • I hit Enter.

  • And now that I did, we can see these are the folders that contained files for PHP, Ben PHP been PHP seven point to live, Doctor, Doctor.

  • So this gives us the locations that where we may want to go.

  • Now the important thing again where there's been PHP and Ben PHP 7.2.

  • This is the type of thing that might cause you a problem in the real world.

  • So you may be looking for some kind of PHP folder.

  • So you're not doing a fine you don't You don't do a list command.

  • You just simply navigate to a PHP for a packet Ford or something else.

  • And what you might not realize is possibly in the newer version of whatever you're using that it's created a different folder.

  • So, possibly instead of trying instead of needing to go to Ben PHP, you need to be in been PHP 7.2.

  • So simply by doing the where is command, you know, if you're having problems, you know Oh, crap.

  • I didn't know that folder existed.

  • Maybe that folder is where I need to go again.

  • This works with the almost anything so path you two is also installed on this You bunch of server ups.

  • Where is where is a patchy to enter and again for Apache too.

  • We can see there are fewer folders for Apache to And we got the s been We got the live we got the e t c share so so forth with Where is you can even do something as simple is fine So where is fined again?

  • So user Ben has fined and that's where the man pages are in.

  • This is where the info pages are.

  • So like, where isn't the greatest things that sliced bread?

  • Is this probably again?

  • You're not gonna be using this every month even.

  • But, you know, one of those times you're installing a new piece of software that you've never installed before trying to find that configuration file.

  • This is a type there.

  • Where is Yeah, let's let's see all the folders that that store information for this application s so that could be useful.

  • So with that, let's go and start looking at the find so clear the screen.

  • And so now we're going to be looking at find so again, P W D that shows us the photo rents on the Bob daughter in the whole quarter on.

  • Then let's take a look at what's actually in the Bob Ford.

  • So we do.

  • L s l a gets to give you an idea, eh?

  • So we have a folder.

  • So I simply created a folder called Folder.

  • And in that folder is a test dot t x t file, then we have test file, not t X t lower case test.

  • Dr.

  • E X t uppercase t arrest lower case E S T T X t all upper case T e s t t X t.

  • And so it is important to understand these are three entirely different files.

  • So, you know, depending on what you're looking for, you you may run into issues again.

  • Do the whole capitalization issue s.

  • So the first thing is, let's take a look at using name, right?

  • So if I d'oh simply if I simply do find if I simply do find, um space, uh, your name.

  • So when I use name, case, case matters, right?

  • So it is case sensitive, and then I do single quotation mark and then I do test not T x t close double quotation.

  • A single quotation mark.

  • So what this is going to do is from so fine?

  • I did not give a location.

  • I did not get location here, so find from starting in this folder going down.

  • So anything Lower.

  • Ah, fine.

  • Name case sensitive test dot T x t.

  • So find me any final called test dot t x t from this folder hit, Enter.

  • And so as we can see here, I have test that t X t.

  • And so this is this one here.

  • So this is in the folder.

  • So this isn't a Bob Porter, but then we can also see in folder.

  • And then there's also a test dot t x t.

  • So again, this could be one of those things you run into an issue of You're looking for a particular high and I file, and you literally might be modifying the wrong one for some reason.

  • Right, Though the FBI and I file the PH.

  • B.

  • I and I fail.

  • You're supposed to be modifying is one, and you haven't modifying the other.

  • So that's something to think about, um, again, one of things to be thinking about is that with that whole wild card again, we could do wild cards with Fine.

  • So we're gonna do is fine.

  • So fine.

  • And then we're still gonna do name.

  • And then I'm going to single the single quotation mark.

  • And then one of things I could do is tasked.

  • And then simply do that star That asterisk clips single quotation marks.

  • So what this is going to is from where we're at, So we're still where we're at Name So case, case sensitive quantifying test and basically anything that starts with test.

  • So I hit Enter here now and enter here.

  • And so the interesting thing here is that we see the test dot t x t as we saw before the test out t X t and the full her that we saw before.

  • And then we also see test file, Doc T X t So again, that kind of shows you like Oh, yeah again, Maybe, maybe if you kind of you know, your misspelling in a little bit You're like I kind of sort of know how to spell it, you know, by plugging in the first couple of letters.

  • Then you throw in a wild card that asterisk wild card that might make your life a lot easier.

  • The final thing that I want to show you here is using my name.

  • So So with this, right, we keep getting test.

  • We keep getting lower.

  • Case tests.

  • So clear.

  • Clear.

  • Just make this easier.

  • See?

  • So clear.

  • Eso Now what?

  • I'm going to It's fine.

  • And instead of name I'm going to I name that single quotation mark test Doc T X t.

  • And so when I do with this this time now when I hit in her right, I get all the test on T x t s o the uppercase test our t x t the lower case Tex test on day 60 The test on lower case test dot t x t That's in the folder and in the upper case t the rest lower case e s t dot t x t.

  • Right, So by using I name that allows me to find that So those were those were some of the things to be thinking about when you're searching for files now, one of things I'm going to show you is that you can also say where to look for files and why you need to use suit.

  • So basically, right now again for looking where we are folder structure Were any Bob folder in the home for?

  • So let's say I want to do find But, um, I do find And I might say, Where'd Where'd I want to start looking?

  • Where do I want?

  • Start looking from this folder down.

  • So I want to start looking and route So I say fine and root.

  • Then I'm going to do name and then I'm going to single quotation test t x t as we did before.

  • Get anybody Guess.

  • Can anybody guess what the error for this is gonna look like It's going to be ugly.

  • My, I want to show you right, because the important thing to understand here is that since we're going to be searching from route when we do not use suit So what we needed it was your suit.

  • Do fine route hyphen Name test on t X t.

  • But since we're not doing pseudo when we enter, we're gonna get is we're going to get this mess.

  • So basically, if you get a mess that looks like this, this means that you do not have permissions to do Be doing the searches that you're looking for, eh?

  • So we're gonna do, We're gonna clear.

  • And so what I gotta do is Sue Dio find Then where do I want to start looking at root?

  • They don't want your name.

  • Then I'll do single test dot t x t close single, single quotation mark.

  • And now, by using the su dio uh, looking password, there is something much prettier, much prettier.

  • So if you get the ugly mess that I showed you before, the problem is is that you're not using suit.

  • So that is one thing to be thinking about and again, just to show you how this could be useful in the real world Sue Dio find.

  • And then let's say my new name.

  • And unless I'm looking for the PHP that I and I file PHP Donna and I file on, Then I hit Enter and this will show me.

  • Okay, Sorry about e t c p 87.2 cli p h a b i e t c p h p 7.2 Apache to PHP gonna die.

  • And so again, this is one of those important things This is a really world thing with something like the PHP not on file.

  • So the PHP not I and I file that we need to modify when we're for when we're dealing with websites is what's in the Apache to sew the Apache two ph.

  • Ph be Donna and I file is the eye and I file that we want to modify.

  • The CLI is for using PHP at the CLI.

  • And so again, this is one of those issues you can run into if you if you're simply going to the client PHP Donna and I file on doing all kinds of modifications and then things are working out properly again.

  • The reason is is because you're simply not going to write PHP, not I and I file.

  • And so those are some things that think about so that we've got those s o let me show you some other just just random once so things that you can look at is again like user, right?

  • So I showed you name and I s so let's say fine.

  • So again gets to show you where rat were at PWD were in the Bob Ford er gets to show you what's in the folder?

  • That's what's in the fort Eso won of things we can do.

  • Let's say there's a lot of different files in a folder they all owned by different users.

  • So one of things we can do is find we're looking in this folder so I don't have to give a location to start looking from five and I can do user.

  • And then I could do single quotation mark than Bob Close single quotation marks.

  • So I confined basically files owned by a user in this pretty go round sense.

  • But I can hit that.

  • And then this gives me all of the files in this folder that are owned by Bump.

  • Now, you'll see some of these files here.

  • These are files that you did not see before When I did the L S D.

  • L come and anything with a period in front is considered a hidden file, so it won't just show up.

  • Normally, when you do list commands, we can see test gets.

  • He tests out T X t.

  • We can see folder on the folder test not t x t blah, blah, blah.

  • So, basically, this is way to look and see, You know what files are owned by particular users s?

  • Oh, that could be a useful thing, then the next one that I think is pretty cool is again.

  • We have the CIA myth argument so we could do fine.

  • Uh, then I could do space and that I could do semen.

  • And so it's seamen.

  • C m I n.

  • Don't be naughty.

  • Don't be naughty hyphen.

  • See what this is Is basically any any files that have been modified in the last however minutes eso I was creating some files.

  • So let's say I want to see find files that have been modified in the last 20 minutes from this folder where we're at, I hit Enter and so I can see that folder.

  • So folder in the last 20 minutes was modified and then folder test Doc T X t was not a modified in the last 20 minutes, so that gives me an idea of the different files or folders that have been modified in that amount of time.

  • So Oh, so let me just do something here.

  • So let me just d'oh let me do them and then I'll d'oh test file for us file for Class Star T X t All right, so let's not create this.

  • This opens up.

  • So this is using them as I should.

  • But you before I'm not gonna put anything in here.

  • I'm going to write Quit.

  • So that's created the file, right?

  • So we're going to clear the scream if I do.

  • L s l just to show you.

  • So this is the file that I create just created test file for class Don t x t Novak was clear.

  • And what I will do is all you find new hyphen seamen.

  • Then I'll do one minute.

  • So find me something that's been modified in last minute inner test file for class, not t X t, and this could be great again for things that have long finals.

  • If you're going to do and you're going through and doing a lot of modifications, a lot of edits, you forget what the hell you were just working on or again, like like one of the big problems.

  • What if you're working on the wrong PHP don and I file you're working on that and you sit there and you're working, you're trying to figure out why something's not working.

  • You're like, Oh, I wonder if I was working on the right pH behind I file and you go and you could do the seamen.

  • You know, whenever it was you modified that that I have I let you go.

  • Oh, and then this pulls it up.

  • Yeah, I did the did the wrong file.

  • So that's one of things that could be used there with that, that whole time setting.

  • And so those are some options for you.

  • The big thing to remember is, if you get a whole bunch of garbage out, you know, with permission issues or anything else, make sure to you soon.

  • Ooh.

  • So there you go.

  • That's a basic overview.

  • How to use where is and the fine commands again.

  • Where is you're probably not going to use it very often, but when you do need to use it, it could be a great tool that could be a great tool.

  • The big thing with the fine command is just to realize these different arguments of the different arguments matter.

  • When you do the find plants, you do find space, then the location you want to start from, so if you want to start from where you're at your from from the folder, Your end down Then you don't put anything there.

  • If you want to start from system route than you do for words last you start from a a different folder.

  • You do forward slash e TC your forest last home Whatever else is basically the location is the second thing that you put in.

  • Then you put in the argument.

  • Ah, hyphen Name is case sensitive.

  • So lower case T e s t t X t is different than uppercase.

  • T s t t x t.

  • So if you know exactly what you're looking for, maybe hyphen name will be the way to g o.

  • I would argue you do hyphen.

  • I name my name is case insensitive, so it would just pull pull back anything that a spell the way that you give it.

  • So that's what I would argue for.

  • Then you do space and then you do single quotation Mark And then whatever it is you're looking for.

  • Test Doc T X t Whatever else do you remember?

  • You can use the wildcat card, the star of the asterisks.

  • So again, if you're looking for PS PHP files and you're not sure what PHP file you're looking for?

  • You knew PHP star, And then you got a whole less total PHP files out there.

  • Probably not the best way to do it again.

  • Life you're looking for I and I files you could do star, you know, single production mark star dot uh, I and I and then that would pull up all the eye and I files again.

  • That's probably want to narrow it down a little bit.

  • But, you know, those are some things to think about beyond the name and the I name.

  • You also have users.

  • So if you have multiple users on your system or possibly like a log, files are like applications or things are long and things under a user account.

  • You might use that in order to try to search for files that might be valuable to you Or also is again the semen.

  • So the hyphen C m i n space hyphen.

  • However many minutes that will show you the files that have been modified and however many, many minutes, one minute, 10 minutes, 30 minutes again, that would be a big thing, especially when you're doing maintenance tasks.

  • You're sitting there.

  • You're like our What file did I edit?

  • You know, saying like, because that's what happens, right?

  • You're sitting there, you do all the edit and you feel really good about yourself on the back.

  • Then you go to test what you did doesn't work.

  • You know why?

  • Why doesn't work?

  • Wait a minute.

  • I edited the file.

  • I did everything I was told to do.

  • But for some reason, it's not working.

  • You do the hyphen, seaman, It pulls up and again, you might find out that you were You were modifying the pH be done.

  • I and I file in the CLI folder versus the Ph.

  • B.

  • I and I file only a Paki to four.

  • So, yes, you did everything right on the wrong file.

  • That kind of thing really, really knows that.

  • So anyways, those air, some things to understand, we find at as with all this stuff and Lennox, there are 1000 more things you could do with Fine.

  • There's a lot of interesting, complicated things that you could D'oh.

  • But realistically, what I showed you today, this is probably what you'll be doing.

  • At least 95% of the time.

  • So as always, I enjoyed a doing this video.

  • And what for?

  • To see on 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 welcome back.

字幕與單字

單字即點即查 點擊單字可以查詢單字解釋

B1 中級

Linux - 在Linux中查找文件(find, whereis) (Linux - Find Files in Linux (find, whereis))

  • 2 0
    林宜悉 發佈於 2021 年 01 月 14 日
影片單字