title: Command to find largest file in hadoop directory
body: <p>I am trying to find the largest file in a given directory on a hadoop filesystem. I found this link: <a href="http://www.tecmint.com/find-top-large-directories-and-files-sizes-in-linux/" rel="nofollow noreferrer">http://www.tecmint.com/find-top-large-directories-and-files-sizes-in-linux/</a>, which showed the following command for finding the largest file:</p>
  
  <pre><code>find /home/tecmint/Downloads/ -type f -exec du -Sh {} + | sort -rh | head -n 5
  </code></pre>
  
  <p>But when I ran</p>
  
  <pre><code>hadoop fs -find [hadoop location] -type f -exec du -Sh {} + | sort -rh | head -n 5
  </code></pre>
  
  <p>I got <code>find: Unexpected argument: -type</code>. </p>
  
  <p>I also ran <code>hadoop fs -du -a | sort -n | head -n 1</code> but the result I was getting was not the largest file in the directory. Would appreciate any help.</p>