Learn the Linux Find Command in Hindi with syntax, practical examples, and advanced options. Search files and directories easily in Kali Linux, Ubuntu, and other Linux systems.
The Linux Find Command is one of the most powerful commands used to search for files and directories in Linux. In this guide, you’ll learn the find command from beginner to advanced level with simple Hindi explanations and practical examples.
Find Command का Syntax:
find [path] [options] [expression]
• find → Command खुद
• path → कहाँ search करना है (e.g., /home, /, /etc)
• options → किस type की file चाहिए (e.g., -type f, -type d)
• expression → किस condition पर search करना है (e.g., -name, -size)
1. Filename से File ढूंढना
Syntax & Example: अगर /home के अंदर sales.txt ढूंढनी है:
find /home -type f -name sales.txt
Output:
/home/sajid/Documents/sales.txt
समझिए:
- /home = यहीं search करो
- -type f = सिर्फ File खोजो
- -name sales.txt = नाम sales.txt होना चाहिए
2. Directory (Folder) ढूंढना
Syntax & Example: केवल Directory खोजने के लिए -type d का उपयोग करें:
find /home -type d -name Downloads
Output:
/home/sajid/Downloads
3. Size के आधार पर File ढूंढना
Size Units: c = bytes | k = KB | M = MB | G = GB
Example 1: Exactly 50 KB की file
find /home -type f -size 50k
Example 2: Exactly 10 MB की file
find /home -type f -size 10M
Example 3: 100 MB से बड़ी file (+)
find /home -type f -size +100M
Example 4: 10 KB से छोटी file (-)
find /home -type f -size -10k
4. User के आधार पर File ढूंढना
जिस User ने file बनाई है उसके आधार पर search करने के लिए:
find /home -type f -user sajid
5. Group के आधार पर File ढूंढना
특정 group से संबंधित files खोजने के लिए:
find /home -type f -group developers
6. किसी Date के बाद Modified File
1 जनवरी 2025 के बाद बदली गई सभी files:
find / -type f -newermt “2025-01-01”
7. Date Range के बीच की Files
1 जनवरी से 10 जनवरी के बीच modified files (NOT operator ! का उपयोग करके):
find / -type f -newermt “2025-01-01” ! -newermt “2025-01-10”
8. Access Date के आधार पर
1 जुलाई के बाद access हुई files को ढूंढना:
find / -type f -newerat “2025-07-01”
9. File के अंदर Keyword ढूंढना (grep)
इसके लिए find नहीं, बल्कि grep इस्तेमाल होता है जो file के content को खंगालता है:
grep -Ri password /home
Output:
secret.txt: password=12345
समझिए: -R = Recursive (subfolders भी), -i = Case-insensitive (बड़ा/छोटा अक्षर समान)
10. Manual / Help खोलना
man find
या फिर short help के लिए:
find –help
TryHackMe / Practice Questions
Q1. Group खोजने का option क्या है?
उत्तर: -group
Q2. User = Francis, Size = 52 KB, Directory = /home/francis के लिए command क्या होगा?
उत्तर:
find /home/francis -type f -user francis -size 52k
Q3. Chatlogs directory में keyword search करने के लिए command?
उत्तर:
grep -Ri keyword /home/topson/chatlogs
याद रखने की Trick (Quick Revision)
| Option | मतलब / Description |
|---|---|
| -type f | File के लिए |
| -type d | Directory के लिए |
| -name | नाम से खोजने के लिए |
| -user | Owner User के अनुसार |
| -group | Group के अनुसार |
| -size | Size के अनुसार (c, k, M, G) |
| -newermt | Modified Date के अनुसार |
| -newerat | Access Date के अनुसार |
| grep -Ri | File के अंदर Text / Keyword खोजें |
Exam / Interview Shortcuts
| Target Scenario | One-Liner Command |
|---|---|
| Find File by Name | find /path -type f -name filename |
| Find Directory by Name | find /path -type d -name dirname |
| Find File by Size | find /path -type f -size 10M |
| Find File by User | find /path -type f -user username |
| Find File by Group | find /path -type f -group groupname |
| Search Content Inside File | grep -Ri keyword /path |
