That was the most passionate "I'm really excited to tell you about it" I've ever heard in my life 0:52
@blakebenner1723 Жыл бұрын
There is a lot to unpack in 'man find'. Thank you for your service!
@jameskiker4128Ай бұрын
who up leveling there bandit rn , all jokes aside i had to watch a video how to get through a bandit level and i refuse to just go on without actually understanding what the process is so here i am, thank you for the information .
@unbekannter_Nutzer2 жыл бұрын
First example: If you omit the starting path, the $PWD is used, so you not even have to type the dot. `find -name *.txt` did only work incidentally, because without masking, the shell will do file name expansion, so if you happen to have one or more files matching the *.txt pattern in your current directory, the find command will see the list of expanded files. `find -name "*.txt"` instead is the thing to do, except you're sure, that there is no file matching your pattern in the current dir. Same problem in min. 21 while searching for *.log and 24 when searching for *.mp3. Min. 9: `find -delete instead of -exec rm {} +` is superior and present in GNUs find for ages. It is able to remove empty directories as well and is much better to type. Since find has so many options, you can talk about them for hours. I guess one of the most important options is searching for age with -mtime. I often know that I search for a file which is maybe 3 to 8 weeks old and it might be a Java file and I'm searching for, let's say, my usage of a JTable. `find -mtime +21 -mtime -56 -name "*.java" -exec grep JTable {} + -ls` If you don't pipe the output to grep, but use grep with exec, you can keep going using other find options. The ls gives a long file output, similar to `ls -l`.
@iconoclastsc2 Жыл бұрын
I just tried the find -delete and it deleted all the contents of the directory instead of just what it found. The man says: Warning: Don't forget that find evaluates the command line as an expression, so putting -delete first will make find try to delete everything below the starting points you specified. I don't know how I'm supposed to use this command. Fortunately I didn't lose anything important.
@unbekannter_Nutzer Жыл бұрын
@@iconoclastsc2 Well, for most options, the order of them doesn't matter, for example `find . -name "*.java" -mtime -3` will find the same files as `find . -mtime -3 -name "*.java`. But if you specify `-delete` in front of other criteria, those other criterias are only considered AFTER deleting, so `find . -mtime -3 -name "*.java -delete` will only delete .java-files, which are less than 3 days old, but find . -mtime -3 -delete -name "*.java` will delete all files less than 3 days old and the following resistriction with `-name "*.java"` is too late. Checking, which file might get deleted isn't trivial either, since '-delete' implies `-depth` which means the deeper files will get deleted before the less deep files, which is important for directories, which can only be deleted, if they are empty.
@zartajmajeed5 ай бұрын
Good advice on quoting any glob patterns with -name - but I never use -delete because it is tricky and difficult to always get right - instead I use -ok rm -v {} \; or -exec rm -iv {} \; to force an interactive prompt to confirm each deletion and see what was deleted - or for a large number of files, first produce a list of matching files like he does in the video - then delete the list directly with something like xargs rm -v
@zartajmajeed5 ай бұрын
Technically "-name", "-mtime" etc are not options to the find command - find actually has just a handful of options like "-H" and "-D" - these other terms that start with a dash are part of the find expression language - they're called "primaries" - they look like options and even act a bit like options but they're not options - think of them like little boolean functions that combine to form the complete query expression - realizing this helps with a lot of confusion around find expressions
@unbekannter_Nutzer5 ай бұрын
@@zartajmajeed Find may use its own nomenclatura; since these options are optional, it's perfectly fine to call them options.
@leythecg2 жыл бұрын
This series is the best I've found regarding Linux! Thank you so much for that!
@dancaputa15433 жыл бұрын
I can't thank you enough for all your videos. Been craming to learn linux so I can use it for a big chia farm.
@franki552 жыл бұрын
Had to sift thru to the 2:22 min mark to actually start content...othewise good video
@DarthDweeb3 жыл бұрын
and the oscar goes to..... I love your videos man. Keep it up.
@ianperkins88123 жыл бұрын
Simple, but incredibly useful. Thanks!
@gnuPirate7 ай бұрын
Thank you for this! It's such an essential tool, but I actually "find" aspects of the usage of this somewhat "basic" or essential command to be a bit difficult to navigate.
@mahirfr3 жыл бұрын
I'm glad this channel is here... ...
@cleightthejw22022 жыл бұрын
Hey dude, you mentioned that band and said it was your 'favorite'. I thought to myself 'I gotta check this out' just to see what that band was/is about as far as their style goes. Gotta tell ya - was not expecting that boss :)
@RichM1967 Жыл бұрын
Find command is great -- locate is also a useful tool to quickly find stuff.
@pitsomokhu63022 жыл бұрын
This Such a Powerful command to automate things as a Newbie.. thank you Very much!!
@cordovajose56935 ай бұрын
Instead of jumping all the way to exec you shouldda explain other optiones to narrow the search like mtime, ctime, find by permissions, exclude dirs (not filtering them out with grep -v) etc.
@ratfuk93402 жыл бұрын
I've used find quite a lot but I didn't know about the exec option. It's nice to know although I dont think I'll use it very often. Nice video
@mhl17406 ай бұрын
Best explanation of find ever! Thank you!
@DaKidReturns3 жыл бұрын
Can you do a detailed video on grep?
@vanitymeetstechnology87922 жыл бұрын
Thanks a lot sir.. how did I Find U on KZbin.. now that I found you.. I have learnt the usage of "find" .. Good day sir
@JohanEkelund843 жыл бұрын
Awesome as always Jay! Extra thanks for the tips on Lacuna Coil, havent heard of them! Btw, I bought your book Mastering Ubuntu server 18.04, half way through it now and love it! Keep up the good work!
@OldDogNewLinux10 күн бұрын
Thank you Jay for the useful lesson on 'find' for this noob. I learned a bunch. Out of curiosity I found a few videos of Lacuna Coil. My 61 year-old ears are now bleeding. They're sort of like Evanescence on a high dose of steroids.
@waltsullivan8986 Жыл бұрын
By not quoting `'*.txt'` you risk matching files in your current directory: 'touch {a,b}.txt;find . -name *.txt' will fail.
@joshmcneil10862 жыл бұрын
I'm loving these videos Jay. I wonder if you might take the time to address those certain concerns surrounding certain options?
@koushik76043 жыл бұрын
Can you please make a video on using makefile for automation? It would be highly appreciated 🙂
@landlocked47713 жыл бұрын
Thanks for that, you had good reasons for doing what you did, some people will show you how to use commands and then I think why would you want to do that, lol. I'm so glad you like making these instructional videos, you are very good at it and your helping a lot of people. Thank you.
@dragonsage69092 жыл бұрын
Great info, glad I was able to 'find' this :) Ty
@mathewkargarzadeh31583 жыл бұрын
THANKS JAY !!!. YOU ARE GREAT. MUCH APPRECIATED !!!
@BujuArena3 жыл бұрын
Thanks for the info. By the way, I noticed you said slash when you were indicating a backslash. I corrected it mentally myself, but others with less experience may not, and may accidentally type a slash instead, which would have unintended results when trying to escape the semicolon.
@sussusamogus7831 Жыл бұрын
loved this, thanks jay
@AnzanHoshinRoshi3 жыл бұрын
Thank you, Jay.
@JL-nc4yz2 жыл бұрын
Dziękujemy.
@hieu-headless Жыл бұрын
Lacuna Coil rocks and you do too!
@cheminchemin23662 жыл бұрын
nice course and nice trick 7:26
@SlideRSB3 жыл бұрын
Why use -exec rm? Wouldn't -delete work okay to delete the results of find?
@abhinav3629 Жыл бұрын
thank you so much. this video was really useful. thank you thank you
@MichaelSalo2 ай бұрын
At 3:39. Why did the command accept a glob pattern without quotes here?
@hariraghu15378 ай бұрын
Good content.. Valuable lessons
@clownpocket2 жыл бұрын
I toured with Lacuna Coil in the 2000's when they opened for a band I worked as guitar tech for (Type O Negative) and also for a short run just with them afterwards. Great music and great people. Do I get a free question? I'm trying to backup photos from my Windows drive in Linux but exclude files that have parentheses. All files containing parentheses are duplicates, for example pic(1).jpg. So I want to find pic.jpg but exclude pic(1).jpg and copy all the pic files onto a backup drive. How might I use 'find' to exclude any files with a parenthesis?
3 жыл бұрын
25:53 You don't have to have "execute" in files, but you need on directories: Windows user goes TILT...
@zypeLLas Жыл бұрын
Cool vid, I did learn something!
@name1355_0ne3 жыл бұрын
Thanks a lot for the video! Found some new bits of knowledge.
@abhimudaliar10643 жыл бұрын
Thanks Jay !
@marcrindermann94827 ай бұрын
Thumb up for Lacuna Coil
@lucaspascual59562 жыл бұрын
Excellent content, greatly appreciated.
@MarkusHobelsberger3 жыл бұрын
I have been using Linux on a desktop for 4+ years now, but I never noticed you cannot open folders which do not have the x permission. Mind blown :D
@anmac6910 Жыл бұрын
How do I copy with cp and exclude all files including files without extensions from a MTP mounted android phone ?
@13thravenpurple942 жыл бұрын
Great work 🥳🥳🥳 Thank you 💜💜💜
@juanrebella25892 жыл бұрын
Thanks! Really helpful. Nacho.
@dawnS33ker2 жыл бұрын
Great tutorial. Thank you sir👍
@rahulchoudhari833 жыл бұрын
hello sir your video is excellent. I Have a doubt. How to find files of size in between 10kb to 30 kb?
@deprimarvin53822 жыл бұрын
You can use `find -size +10k -size -30k`
@Anonymous-XY Жыл бұрын
Thank you very much.
@DaKidReturns3 жыл бұрын
Great content, following your channel since 2019 and really love your stuff. Can you make a video on gpg I think it is a bit over looked
@WorldWorrier32732 жыл бұрын
You are Awsome🤜 men, you are a very good teacher really🥳.
@Hunterrr152 жыл бұрын
Awesome tutorial. Thank you :)
@GreedoShot6 ай бұрын
video starts at 2:58
@k.chriscaldwell41412 ай бұрын
Great. Thanks.
@piotrkondzioka40093 жыл бұрын
great lesson! thanks a lot
@gdiaz88272 жыл бұрын
why isnt there a standard command set for linux instrad of worrying about distros
@harunaadoga Жыл бұрын
Thank you!
@pradeepkumar-ew1ze3 жыл бұрын
Does this applicable to mac terminal? I dont see the "exec" working.
@thingsiplay3 жыл бұрын
In Windows you have to search something. In Linux you just find it.
@YannMetalhead2 жыл бұрын
Good explanation.
@ghostintheshelf86608 ай бұрын
Lacuna Coil + your last name LaCroix.... make me think you're a VTMB fan ;)
@amortalbeing Жыл бұрын
thanks a lot. this is great
@samirfighter12137 ай бұрын
very helpful
@lsatenstein3 жыл бұрын
HI Jay, Yes, I followed this "lecture" about find today, because I was hoping that you would be able to help me with a challenge. Every month, I want to copy from a tree of directories and paths, the additions that were created some 30 days ago. Ideally, I have a tree of folders /backup/2021/0101 /backup2021/0201 .... As an example, the contents of 2021/0201 should contain only the new files to backup for that month. I was considering to use find's -mtime somehow. I am not sure if that is what I need to use. I was reviewing your examples, and did not see a way to do date range exclusion/selection with find. man and info pages were not too helpful. Have you some example from one of your private utilities that you can share? After some research, I also discovered pax a similar program to find. Perhaps pax is the utility to use. Your opinion or recommendation would be preferred. Regards from Montreal Quebec Leslie
@DevendraKumar-cr6to3 жыл бұрын
Are you using OpenSuse?
@basavarajus75903 жыл бұрын
How make dual boot Linux mint cinnamon 20 to windows 10 please make me one video on this topic
@marcin2x4 Жыл бұрын
Very nice music taste ;)
@burstfireno16177 ай бұрын
Hmm. How do you find a file by its name?
@kentw.england23052 жыл бұрын
I learned to use find | xarg but -exec is easier and better.
@unbekannter_Nutzer2 жыл бұрын
Yes, many people learn xargs that way, because there are few usages for xargs at all, if you know find -exec :) .
@lessevilgoog3 жыл бұрын
Nice job
@guilherme50943 жыл бұрын
Thanks!
@fordthink3 жыл бұрын
Instead of displaying the file path for each of my results (from a find command), suppose I want just the file names. What command should I attach with to my find command?
@deprimarvin53823 жыл бұрын
You can use "basename" find ~ -name \*.jpg -exec basename \{\} \; You have to terminate the command with "\;" so that the command is executed for every finding. If you use "\+" as a terminator, the command will throw an error: "basename: extra operand" So choose the terminators wisely!
@unbekannter_Nutzer2 жыл бұрын
find -name "*.txt" -printf "%f "
@sohaibesohaib2914 Жыл бұрын
thank u
@z8669zzz2 жыл бұрын
find the stuff I knew was somewhere!
@sWi5s3 жыл бұрын
You should have mentionned that the * must be escaped, you're gonna confuse people.
@raghulrags3 жыл бұрын
What will hapn if not escaped??
@tiagorsacxs13 жыл бұрын
You are awesome ....
@DaveSomething3 жыл бұрын
find ~ -name **derp** (edit: had to add extra asterisks, it bolded) or locate derp same results, for me anyway. any differences?
@DaveSomething3 жыл бұрын
just as a quick locator, find does have its uses though, it's got a lot of extras
@GooogleGoglee3 жыл бұрын
In reality the \; and the + has a different purpose especially related to performance/efficiency. Anyone knows exactly the difference?
@deprimarvin53823 жыл бұрын
There really is a difference in how the command to be executed is build. If I got the man page right, with "\;" the given command is executed for each and every finding. If you have 5 findings, the command will be executed 5 times. With "\+" (this should be escaped as well) the command is executed only once with all the findings added to the command at the end. Therefore the "{}" must be the very last argument before "\+". So if you have 5 findings here as well, the command will be executed once with all 5 findings added as arguments. Some examples: find ~/Documents -name \*.txt -exec cat \{\} \; findings file1.txt, file2.txt, file3.txt Will result in: cat file1.txt cat file2.txt cat file3.txt find ~/Documents -name \*.txt -exec cat \{\} \+ findings file1.txt, file2.txt, file3.txt Will result in: cat file1.txt file2.txt file3.txt Another example: You want to create an archive off all your JPGs. What happens, if you use this command? find ~ -name \*.jpg -exec tar -czv pictures.tar.gz \{\} \; Well, the tar command is executed for every finding, overwriting the archive each time. In this case you should use: find ~ -name \*.jpg -exec tar -cvf pictures.tar.gz \{\} \+ Hence all the found files are given as a parameter to the tar command, resulting in a tar ball with all the files you want. I hope that makes any sense to you.
@GooogleGoglee3 жыл бұрын
@@deprimarvin5382 make sense! Thank you for your time to explain it so gracefully Would be nice if the man pages would have more examples and clear explanations
@unbekannter_Nutzer2 жыл бұрын
@@deprimarvin5382 Mostly right, but you don''t have to mask the + and not even the curly braces. Well - maybe you don't use bash to call find, then I might be wrong, but I doubt it.
@deprimarvin53822 жыл бұрын
@@unbekannter_Nutzer you are totally right. I even do not know anymore, why I masked the curly braces.
@unbekannter_Nutzer2 жыл бұрын
@@deprimarvin5382 Well, the man page of find states, that you should mask them, but so far, nobody could tell me an example command, where it makes a difference, except when calling a subshell.
@mason87143 жыл бұрын
i get this when i do that find: paths must precede expression: `temp2.txt' find: possible unquoted pattern after predicate `-name'? What does that mean?
@NoEgg4u3 жыл бұрын
Run the command again, but escape the asterisk. For example: $ find /home/Mason -name \*.txt To understand why you ran into your issue, run this: $ ls -l *.txt You will see more than one match. Due to having multiple matches, those matches are applied to your "find" command line. To test what you originally ran (which gave you the error), then run it again, with the echo command: $ echo find /home/Mason -name *txt You will see that the shell replaces the *txt with all matches, and that is what screwed up the find command. Jay did not run into this problem, because he never had any matches to *.txt in his working directory. So the shell kept the asterisk intact and sent it to the find command. For example, if you were to run: $ echo find /home/Mason -name *somefile-that-is-not-here-blah-blah-blah then the above will leave the asterisk there, because the shell will not match it to any files (which is how Jay avoided getting tripped up with his examples). Note that if you have a single file that matches the *.txt criteria, then if you do not escape the asterisk, you will end up searching for only that one file. Always escape the "*" when using the find command (and lots of other commands, too). Escape the ? character, too. Cheers!
@MarkusHobelsberger3 жыл бұрын
Noob question here: I have seen people use ` and ' in different spots of commands like you did for example with `temp2.txt'. Is there any difference to just using 'temp2.txt'?
@NoEgg4u3 жыл бұрын
@@MarkusHobelsberger Are you asking about the difference between the "backtick" vs. the "single quote" characters: ` ' ?
@MarkusHobelsberger3 жыл бұрын
@@NoEgg4u Yes, exactly.
@NoEgg4u3 жыл бұрын
@@MarkusHobelsberger The backtick will get processes by the shell, ahead of the command you are executing. The result of whatever is between the backticks will be what gets inserted on the command line, to be executed with the rest of the command line. For example: $ echo The date and time are `date` The above will echo: The date and time are Wed Jul 28 13:00:44 EDT 2021 Single quotes are used for literal processing. Whatever is between the single quotes be be read by the shell, literally. So substitutions will take place, for whatever is between the single quotes.
@carparkdoobrie3 жыл бұрын
To find your car keys look in th pockets of your Kaki trousers
@shawnlewis3892 жыл бұрын
Hey Jay. Great video. I have been watching your videos for a while now. And I get a lot out of them. I have recently been told by the contract company that I work for that I have to get my Linux+ XK0-004. That is okay with me. I don't mind doing so. Can you recommend some study resources that will focus specifically on the exam topics?
@sybex200 Жыл бұрын
Comptia has retired XK0-004,the new exam is XK0-005.
@shawnlewis389 Жыл бұрын
@@sybex200 Thanks. I was tracking that. However my company specifically asked for 004, so...I got it. Locked it up about 2 weeks before expiration.
@joseph_donovan3 жыл бұрын
Jay, please ! Leave the jokes of profound feebleness to Mac users!
@subtitles14923 жыл бұрын
2:27
@dougtilaran34963 жыл бұрын
I like catfish
@nevoyu3 жыл бұрын
I learned how to use the find command before I ever learned how to use man, lmao
@patrickmeylemans96273 жыл бұрын
Apt install mlocate Updatedb Locate file name
@LearnLinuxTV3 жыл бұрын
That’s what I used when I first started, before learning find.
@unbekannter_Nutzer2 жыл бұрын
If you remember significant parts of the filename, yes. With find you can search for files, modified 6 to 8 weeks before with a size below 50k, user u and permission p, exclude significant parts of the file system, youngest files without rerunning updatedb and search files in directories, omitted by updatedb. Then you may perform different operations with -exec on them, print output in customized way with -printf.
@dougtilaran34963 жыл бұрын
I just use Alexa. Find my bong
@morenteria29883 жыл бұрын
Jay, you’re a fu……wait, what video is this? Oh yeah, Jay you’re a funny guy!
@geogmz82773 жыл бұрын
Hey man! You shouldn't share your $HOME location on the Internet you can end up swatted.
@dr.mikeybee3 жыл бұрын
Find is great, but mlocate is better.
@joanarling3 жыл бұрын
What if you search for files that have been created during the last week? You use "find", not "mlocate".
@dr.mikeybee3 жыл бұрын
@@joanarling Yes, find has much more functionality, but 9 times out of 10, all I want is to find a file by name. mlocate is a 100 times faster. It doesn't produce error output that needs to be redirected, and the syntax is intuitive. Yes, I love the find command when I want all files created or modified in the last 3 minutes, but I rarely need that.