In this video, I go over how to find files in Linux terminal. In this Linux Tutorial you will learn everything you ever wanted to know about the find commend and even some stuff you didn’t know you wanted to know.

Basic syntax
-find options starting/path expression
$ find ~ -name media*
Note: -name is CASE SENSITIVE for results
$ find /var/html -name *.html
$ find ~ -type d -iname Downloads
Note: -iname makes it so results are not matched based on CASE.

Advanced syntax
Find Files based on modified in the past 1 day
$ find ~ -mtime -1
Note: cull this down by using | grep partial file name
Or Find Files based on modified in the past 10 minutes
$ find ~ -mmin -10
OR find Files based on modified in the past 10 minutes and greater than 10 megs
$ find ~ -mmin -10 -size +10M

You can also add the -delete command at the end to delete ALL FILES FOUND!!! Use with extreme caution!

Bonus easily find where a program is located with “whereis”
$ whereis gimp

💻 Recommendations 💻
– My Windows Anti-Virus ➜
– My VPN Service ➜
– Website Recommendations ➜

🕹 Live Streams Monday & Friday 🕹
– Twitch ➜
– YouTube Archive ➜

🖥 Contact me 🖥
– Patreon ➜
– Official Site ➜
– Twitter ➜

🚑 Need Help!? Ask our community! 🚑
– Discord ➜
– Reddit ➜

💰 My Amazon Store (YouTube Gear, PC Hardware, and Books I recommend) 💰

DISCLAIMER: This video and description contain affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This helps supports the channel and allows us to continue to make videos like this. Thank you for your support!

Nguồn: https://codeigniterbrasil.com

Xem thêm bài viết khác: https://codeigniterbrasil.com/lap-trinh-linux/

21 Comments

gilkesisking

April 25, 2020

Good stuff Chris. Additional options for find…
-perm 777 ( permissons )
-empty
-maxdepth ( how far down the tree you want to look )

locate command is another good one.

Reply

Mark G0usl

April 25, 2020

whereis DAMN! just brilliant. Never heard of that one before Very useful thanks

Reply

Gary XHLC

April 25, 2020

Thank you, even after using Linux for 10 years and trying to puzzle out man pages (which are complete, detailed, factual, and often utterly useless), I'd given up on finding via terminal (except for executables when I can use whereis ) because I never got the command parameters right — I'd either get no result, or the entire disk volume listed!

Reply

Jurgen Blick

April 25, 2020

Love your stuff

Reply

Zellonous

April 25, 2020

Helpful. Thank you.

Reply

deemon

April 25, 2020

What is the widget you use in your right bottom corner that shows core and disk usage?

Reply

Shriniwas Kulkarni

April 25, 2020

Awesome video on Linux "find" command. learned so much.
If you can, If possible can you make one video on Linux file system or file system hierarchy? and how it works?
Thanks for the video!

Reply

footb 4all

April 25, 2020

Great,you should be mentioning mlocate command

Reply

HewFreBie

April 25, 2020

GNU/Linux or Unix-like joke:
sudo whereis cat?

Reply

fourdotsYT

April 25, 2020

Also find a command with:
$ which <command>

e.g.
$ which mv
/bin/mv

Reply

David Heremans

April 25, 2020

Chris, you should have used 'media*' between quotes.
If you had a file in your current directory named fi. 'media.jpg' then bash would have replaced your medi* with media.jpg and you would be looking only for that filename.
If you had two filenames starting with media, bash would have replaced media* with those 2 names and the find command would have thrown an error.

So I guess it is time for you to make a video talking about wildcards and globbing 😉

Reply

suT3

April 25, 2020

Just wondering: why 46GB of swap?

Reply

teamvigod

April 25, 2020

Should also cover "slocate" command. Super quick, easy and secure way to index and search for files:
https://linux.die.net/man/1/slocate

Reply

Anthony Rima

April 25, 2020

Congrats on 10k followers! Another great video, I'm loving these

Reply

Theodoros Nicolaou

April 25, 2020

This is going to be so useful, thanks! Awesome video, as always.

Reply

Sebastian Dumbrava

April 25, 2020

I see u reached 10k subs. congrats 🙂

Reply

tpasi2020UG

April 25, 2020

Thank you! Thank you! Thank you! Thank you! Always wanted to learn this. Thank you!

Reply

Solo B

April 25, 2020

You're killing it Chris!! I love these kinds of videos. However, I'd like them to be a bit more detailed for beginners like me. Also, longer tutorial from you is always awesome!
Cheers.

Reply

Lifeless web user

April 25, 2020

Can you do a video about what you think ov Richard Stallman?

Reply

stuart

April 25, 2020

Wait. So the options only use 1 dash "-"?! I thought when the options used words it was 2 dashes "–"? Ex: `ls -h` == `ls –human-readable`

Reply

Chris

April 25, 2020

Hey Chris,

From a Terminal beginners perspective i feel like you went really really fast in this video, id like to know what every bit of the command does and have time to comprehend that personally, like really overexplaining things would be helpful for it to stick in. Overall though its a wellmade video with great info, thanks 🙂

Reply

Leave a Reply