【问题标题】:Command to find largest file in hadoop directory在hadoop目录中查找最大文件的命令
【发布时间】:2017-05-07 10:38:30
【问题描述】:

我正在尝试在 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,但我得到的结果不是目录中最大的文件。将不胜感激。

【问题讨论】:

  • 你试过hadoop fs -ls -S |head -1 吗?我不使用 hadoop,我不确定 ls 是否存在 -S。

标签: bash hadoop directory find large-files


【解决方案1】:

在Linux下可以运行以下命令查找桌面目录中最大的文件,如果要查找最小的文件,去掉sort的-r参数!

du ~/Desktop/* | sort -n -r | head -n 1

对于 HDFS,您可以尝试以下命令

hadoop fs -du <Path-in-HDFS> | sort -n -r | head -n 1

【讨论】:

    猜你喜欢
    • 2021-11-21
    • 2022-01-06
    • 2010-10-13
    • 2014-06-02
    • 1970-01-01
    • 1970-01-01
    • 2016-11-21
    • 2017-08-21
    • 2013-01-08
    相关资源
    最近更新 更多