Search code examples
filehadoopfilesystems

find file in hadoop filesystem


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?


Solution

  • If you are looking for equivalent of locate Linux command than such option does not exist in Hadoop. But if you are looking for the way of how to find specific file you can use name parameter of fs -find command for this:

    hadoop fs -find /some_directory -name some_file_name
    

    If you are looking for the actual location of hdfs file in your local file system you can use fsck command for this:

    hdfs fsck /some_directory/some_file_name -files -blocks -locations