Stage 3 · Lesson 3 of 8
Finding files with find
The walks through a folder and everything inside it, and matches files by name, type, size or age. find . -name "*.log" finds . find . -type d -name node_modules finds folders with that name.
find . -size +100M finds files over 100 MB, and find . -mtime -1 finds files changed in the last day. It can also act on what it finds, with -delete or -exec, which is powerful and dangerous. Always run the search on its own first and read the list before adding an action. searches inside files; find searches for the files themselves, and the two often work together.
Common trapputting -delete in the wrong place in the expression and removing everything find visits.
A question to check yourself, an AI practice session and 1 cheat sheet entry come when you add the roadmap to your account. Add it
Resources for this stage
Start with· follow one of these
- CourseFreeThe Missing Semester of Your CS Education
MIT · Beginner
The data wrangling lecture walks through grep, sed, awk and regular expressions on real logs
- BookFreeThe Linux Command Line
William Shotts · Beginner
Clear chapters on text processing, regular expressions and searching for files