The find Command
In this page:
The find Command
find searches a directory tree for files and directories matching criteria like name, type, or modification time. find . -name "*.txt" searches the current directory recursively for files ending in .txt. It's far more powerful than simple globbing for searching nested directory structures.
Note: find . -name "*.log" -mtime -1 finds .log files modified in the last day — great for log cleanup scripts.
Example: The find Command
#!/bin/bash
mkdir -p search_demo
touch search_demo/a.txt search_demo/b.log search_demo/c.txt
find search_demo -name "*.txt"
Login to try C/C++/Java/PHP code in the editor
🔒
Chapter Quiz — Complete all 13 topics to unlock
0/13 topics done
Complete these topics first: