find कमांड
find घर के हर room में एक scavenger hunt जैसा है। आप describe करते हैं कि आप क्या ढूंढ रहे हैं, जैसे इसका name या type, और यह आपके लिए सभी folders search करता है।
In this page:
Syntax
find directory -name "pattern" -type f|d
find Command
find name, type, या modification time जैसे criteria से match करने वाली files और directories के लिए एक directory tree search करता है। find . -name "*.txt" current directory को recursively .txt से खत्म होने वाली files के लिए search करता है।
यह nested directory structures search करने के लिए simple globbing से कहीं ज़्यादा powerful है।
Note:
find . -name "*.log" -mtime -1 पिछले एक दिन में modify की गई .log files ढूंढता है — log cleanup scripts के लिए great।उदाहरण: 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
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the
view already swaps in the hi_ translation fields (or blanks these
out if untranslated), so this renders correctly for both languages
without a lang_code check here. #}
आम गलतियां
- Patterns को quote करना भूल जाना, जैसे
find . -name *.txt, जिसे shell पहले expand करती है। - Options को गलत order में रखना, जैसे tests के बाद
-maxdepth, जो एक warning देता है। -execको\;या+से end किए बिना उपयोग करना।
🔒
Chapter Quiz — Complete all 13 topics to unlock
0/13 topics done
Complete these topics first: