Is there a way to locate a specific file in hadoop?
I know, that I can use this: hadoop fs -find /some_directory
But, is there a command like this: hadoop locate some_file_name?
hadoop fs -ls defaults to /user/userName, so you can leave the path blank to view the contents of your home directory.
hadoop fs -ls
To find a file in the Hadoop Distributed file system:
hdfs dfs -ls -R / | grep [search_term]
In the above command,
-ls is for listing files
-R is for recursive(iterate through sub directories)
/ means from the root directory
| to pipe the output of first command to the second
grep command to extract matching strings
[search_term] file name to be searched for in the list of all files in the hadoop file system.
Alternatively the below command can also be used find and also apply some expressions:
hadoop fs -find / -name test -print
Finds all files that match the specified expression and applies selected actions to them. If no path is specified then defaults to the current working directory. If no expression is specified then defaults to -print.