Today on haktip we're using the find command and this hack tip is brought to you by Eero
Welcome to hack tip the show where we break down concepts tools and techniques for hackers, gurus and IT ninjas
I'm your host Shannon Morse and today
We are talking about the find command
so one of my viewers reached out on Twitter and asked have you done an episode on the find command and I was like I
Am now, so here is your find command episode sir
It's sort of like locate and grep, but find just happens to be, well pretty powerful
I mentioned it in a previous episode
But it does make sense to repeat it here locate depends on an ever changing database so it is fast
But it is dependent fine searches on the fly and you can specify search criteria it is slower
But it can do a lot more than locate can so let's go through some of the options that are most useful
Well at least I consider them most useful with find so find searches recursively through directories starting with the top
Directory and on down so you can simply type something like this
Find dot tack name
And I'm gonna use wallpaper2.PNG as an example and this will find my wallpaper
PNG file how
exciting now if I type
something similar find dot tack name
wallpaper
With no 2 dot PNG after it it won't find anything because I did not include any kind of wildcard after it so it was
Expecting to find something specifically called wallpaper another thing to keep in mind
Find includes folders because folders are also considered files so to add a wild-card
You just gotta stick it in quotes something like this. I would type in find dot tech name
wallpaper
Add asterisk and then close out those quotes
Okay
So this will find all of my files that have wallpaper in the name in this case using the dot
Tells find that I want to use a relative path for output
You could also use a forward slash, which tells it to use an absolute path instead, so if I did that
I'll go ahead and try testing it okay
so that found a lot of
Information so I think I'll just clear that out and stick with the period instead because it's much easier to understand on camera at least
So we're going to stick with the period next up you can search by
Ownership so to do this you simply type in something like find tack user and I'm gonna use myself as an example
hit enter
Alright, so this will find everything that is owned by that user
Alternatively if you have another user that you want to search under or if you want to find anything that is not owned by snubs
You can add an exclamation
Point right after the period and then hit enter and it's not gonna find anything because I own everything on this system
So no surprise there, but this is going to search for files that are owned by anyone
That is not
Snubs in this case so this can be super useful if you need to change the ownership of files with chown
For example and I spoke previously on chown in a previous hack tip now
You can do the same thing with groups as well
you simply take instead of putting user you would change that to a group so I'll type in Group and
For this example. I don't have a lot of groups on this machine
I'll just use sambashare and I don't think it'll find anything actually. I'll use the exclamation
So that is going to find everything that is not in the sambashare group because just so happens
I don't have anything in the sambashare group right now
But if I did want to find something that has a group that I need to change I can simply
Go on from there and use
Chgrp, which is changed group for anything. That's in the wrong group now
I will give you a few more examples to find right after this break when you're looking to improve your wireless network
Making sure that your entire home has a strong signal is a definite must
That's where Eero comes in they are launching the very first second generation mesh Wi-Fi system that comes with one Eero
and one to two beacons these are mesh access points. They're not extenders
They're much smaller than the originals they plug into an outlet
They have an ambient nightlight in case you got to get up in the middle of the night
And they are more powerful than the originals as well, but if you already have the original Eero devices that's totally cool
too Eero has your back these babies are backwards compatible and they can be purchased separately so systems start at
$399 for all of the components together
But if you just want to buy one beacon to add-on you totally can and those are $149 each
We've gotten a chance to test these in the warehouse so I can honestly say our
Wireless usually does not reach from one end to another
But the Eero mesh does a really great job of fixing that headache and giving me the speeds that I pay for from my ISP
Plus it's very easy to set up
It's really reliable too. Eero is also announcing the Eero Plus subscription, which includes advanced network security monitoring
Supplementing the features that are already built in that you get for free with the device and content filtering
Which is also really great for houses with kids now with any system you get automatic
Updates you get two-factor authentication for your admin access you get Eeros backing with a bug bounty program
And they also do third party audits, which is awesome
We also have a coupon code for you
For free overnight shipping to the US or Canada you can visit eero.com and at checkout select overnight shipping enter haktip
h-a-k tip to make it free check it out and learn more at
eero.com we are now back with
Find so next up is searching by file size this can be super useful if you're looking for a larger file on your computer
Maybe to save some room you want to find some files to delete or you want to find a specific
video that you would download it or something like that so to do this you simply type in
find
Period tack size, so I'm changing that to size this time, and I'm gonna use an example. That's very specific
854k in my case so that doesn't show anything
Why that is because it's looking for a file that is exactly that file size
And I don't have anything that is exactly that file size if I want to find anything that's larger than
854 kilobytes I can add the plus right in front of the number and that will find anything that is larger than that
854 kilobytes I could also do the same thing if I want to find anything smaller with a
Minus instead of a plus and of course we're going to find a lot of info there
So let's stick to plus instead because it's a great example
The K in this case stands for kilobytes that's probably very obvious then we also have a "b" for
512 byte blocks that's the default so if you don't put a letter after your number it's good just gonna stick with
512 byte blocks "c" is for bytes
BYTES "k" is 4 kilobytes an uppercase "M" is
for megabytes and an uppercase "G" is for gigabytes, I don't think they have anything for terabytes yet
We'll see in the near future comment below if they do but I'm pretty sure they don't lastly for today
I also wanted to touch on the type option so type allows you to look for a
Specific file type be it a regular file a symbolic link
a directory or whatever it might be so remember that everything on a UNIX system is a
File in some way shape or form I covered this
Really early on in my series of Linux hack tips so check out our YouTube
Playlist for those older episodes so to do this I can use find again. I'll type in find
dot tack type
and
I'm gonna use "d" to see all of the
Directories that are currently available on my computer if you want to search for file types in a specific
Directory you can also do that by changing the period to the directory name so instead I could type in something like
Let's see if this works. I think it's like that yeah test so test forward slash
will find test and then test 2 which is the second directory that is
inside of there you can also take it a step further by
sorting a long list and to do this you would type in I'm gonna use that example again and
Add a pipe so I'm piping that command over to sort and this is going to sort it so now you'll see this patreon
Stuff folder at the very end while you see my hack 5 stuff folder way at the top cool
I'll delve into a few more things you can do with find on the next episode in the meantime
Practice these get handy with them be sure to subscribe to our YouTube channel as well
Which is youtube.com/hack5 and hit that little like button if you got some good info out of this episode
Until then I want to hear your feedback comment below be sure to check out our sister show for more
Hak5 episodes of greatness just like this. I'll be there reminding you to trust your Technolust