How to use find command
Depok,Two days ago I finally understood how to use find command properly. Previously, when I want to search for a file recursively in a directory, what I would do is find DIRECTORY_NAME | grep PATTERN. The command would then spit a large amount of text and I would manually scroll my terminal window to see if the file I am looking for is found. It is embarassing, I know. But I don’t know any better way. I know that the find command is the perfect tool for this use case but I just don’t have the patience to read the man page. It looks hard too, you know. I mean, it’s a very long passage of text and I couldn’t bring myself to read it. Don’t know why.
However, things have changed! A few days ago I had to read find man page because I needed to do something that cannot be done with my find and grep trick. Upon reading, I felt so enlightened. The stupid find DIRECTORY_NAME | grep PATTERN can now be done by a simple find DIRECTORY_NAME -name PATTERN -type f! I should have read the man page seriously sooner. It wasn’t such a tough read too.
So, a note to myself, don’t ever use the find and grep thing again. Just use find properly!