我正在尝试在hadoop文件系统上找到给定目录中的最大文件。我找到了这个链接:http://www.tecmint.com/find-top-large-directories-and-files-sizes-in-linux/,它显示了以下用于查找最大文件的命令:
find /home/tecmint/Downloads/ -type f -exec du -Sh {} + | sort -rh | head -n 5
但是当我跑步时
hadoop fs -find [hadoop location] -type f -exec du -Sh {} + | sort -rh | head -n 5
我得到了find: Unexpected argument: -type
。
我也运行hadoop fs -du -a | sort -n | head -n 1
,但我得到的结果不是目录中最大的文件。非常感谢任何帮助。
答案 0 :(得分:2)
在Linux中,您可以运行以下命令查找Desktop目录中的最大文件,如果要查找最小尺寸的文件,请删除sort的-r参数!
du ~/Desktop/* | sort -n -r | head -n 1
对于HDFS,您可以尝试以下命令
hadoop fs -du <Path-in-HDFS> | sort -n -r | head -n 1