HDFS DFS find
The hdfs dfs -find
command in Hadoop is used to search for files and directories in the Hadoop Distributed File System (HDFS) that match a specified expression or pattern. This command is similar to the find
command in Unix/Linux but is designed specifically for HDFS.
The basic syntax of the hdfs dfs -find
command is as follows:
hdfs dfs -find <path> <expression>
<path>
: The starting path or directory in HDFS where the search will begin.<expression>
: The search expression or pattern that specifies the criteria for matching files and directories. This can include wildcard characters and other search options.
Here are some examples of how you can use the hdfs dfs -find
command:
Find All Files and Directories in a Directory:
- To list all files and directories within a specific directory in HDFS, you can use the command like this:
bashhdfs dfs -find /user/hadoop/data
Find Files with a Specific Name:
- To search for files with a specific name within a directory and its subdirectories, you can use a wildcard expression like this:
bashhdfs dfs -find /user/hadoop/data -name "file.txt"
Find Files Matching a Pattern:
- You can use wildcard characters to match files based on a pattern. For example, to find all
.log
files, you can use:
bashhdfs dfs -find /user/hadoop/logs -name "*.log"
- You can use wildcard characters to match files based on a pattern. For example, to find all
Find Files Modified Within a Specific Time Range:
- You can use the
-mtime
option to search for files modified within a specific time range. For example, to find files modified in the last 7 days, you can use:
bashhdfs dfs -find /user/hadoop/data -mtime -7
- You can use the
Find Files Owned by a Specific User:
- To find files owned by a specific Hadoop user, you can use the
-user
option. For example:
bashhdfs dfs -find /user/hadoop/data -user johndoe
- To find files owned by a specific Hadoop user, you can use the
Hadoop Training Demo Day 1 Video:
Conclusion:
Unogeeks is the No.1 IT Training Institute for Hadoop Training. Anyone Disagree? Please drop in a comment
You can check out our other latest blogs on Hadoop Training here – Hadoop Blogs
Please check out our Best In Class Hadoop Training Details here – Hadoop Training
Follow & Connect with us:
———————————-
For Training inquiries:
Call/Whatsapp: +91 73960 33555
Mail us at: info@unogeeks.com
Our Website ➜ https://unogeeks.com
Follow us:
Instagram: https://www.instagram.com/unogeeks
Facebook:https://www.facebook.com/UnogeeksSoftwareTrainingInstitute
Twitter: https://twitter.com/unogeeks