Finding files and directories often time system administrators or system engineers or technicians,
whoever the user of Linux is, they forget where files are located, just like in Windows.
When you want to file, find a file, you are given a little search box and the top off the window and
you type in the search and looks for its file.
It takes a very long time, of course, in Windows, but in Linux it's a lot faster and a lot easier.
So there are two main commands that are used to find files and directories in your system.
And the reason you need to find it.
If you remember, I gave you an example of our closet.
You go into our closet, you want to find a shirt that you haven't been worn for a long time and you
don't know where you have it, which drawer of its.
You do need to have tools to look for those files, and those tools in Linux are find and locate.
So we're going to use those commands in our Linux environment and do some exercises and see how they
work.
So here we have our Linux machine, and let's find out where we are.
We are in our home directory and in our home directory.
We have files.
Different files in different.
Actually, I wanted to go into Seinfeld. Directory and I want to see what's inside of it, inside of
it.
There are different files called Cambridge or Jerry Puddy, Seinfeld characters, all those different
paths.
Now what if you are, you go back one step and you are in home directory?
And here you.
You thought that you created a file called Kramer in this home directory, but when you come in here,
you don't see it.
So you could either go into each directory one by one, do else command and find it, which is very
cumbersome.
You don't want to do it.
So you could find it by the command.
Find the first.
The syntax of the command is find.
And where do you want one to find it?
You could give a relative path, which is not.
Which means in this current directory stopped the search from this current directory and this directory
is home of Zelt.
So find Dot Dash Name Space, Double Coat, Kramer double code close and you hit enter.
It's going to tell you that the Kramer file is inside of Seinfeld directory and it's in there starting
from this current directory.
So this contract he has signed for the writer?
Yes, of course.
And now I know I created that Kramer file in Seinfeld.
OK, perfect locate command works the same way.
So you are in your home directory and you want to locate Kramer.
This is telling you exactly where that file is.
Flying command is used sometimes to look for files in a very high rocky way where you have tons of different
factory where Locate is going to find you in an assured searches.
So if you want to find where, let's say our network file is where they it located.
So if you see find slash because you want to find that network file from the root of the file system
because you don't know where that file is starting from, which directory.
So you always start with root space, dash name, comma, FCF g dash.
And what is our interface?
We don't know our interface, so we'll just control C and we'll do if config.
And our interface ENP as zero as three.
So find slash name CSG.
This is the name.
This is a file name of our interface, which we will cover, by the way later, and we want to find
it.
We are getting all the permission denied.
Whoa.
Whoa, whoa.
Whoa.
OK.
Relax.
Why are we getting permission denied?
Why didn't find it?
Hmm.
OK.
I know why.
And I'm sure you guys know why, too.
Because you do not have permissions to go into certain directories.
So why?
Because you are.
I have cell and who have permission to go into different directories.
Tell me, Root.
Yes, Root has it.
So you do sue Root to become root put in the password.
Now you run that command find slash from the beginning CSG, Dash and P.
I always forget that sorry.
OK, so find slash name and if CFG Dash ENP zero as zero three and now I'm going to run it now it's
going to go into every directory and look for it.
The first one is just a run directory.
I suppose this is just the process itself.
So don't worry about it.
You could, nor second one, you'll see it.
Found it.
It is telling me this file that you're looking for is an Etsy system config network.
That's great.
And if CFG, Dash, ENP, PS4, S3, if someone asks you where is that file located, as if it's in
just a general question or if it's an interview question, you know the best way to answer it is I will
run my fine command or locate command to find where that file is located.
So practice those two commands.
Run man on these commands and look for different options that you could use for these command and see
how easy it could become for you.