From f6990e06b4d2dbffb2758ab89ef855ba3947bcf3 Mon Sep 17 00:00:00 2001 From: Christopher Douglas Date: Mon, 23 Nov 2009 00:59:29 +0000 Subject: [PATCH] HADOOP-6375. Sync documentation for FsShell du with its implementation. Contributed by Todd Lipcon git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@883206 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 +++ .../content/xdocs/file_system_shell.xml | 12 +++++++--- src/java/org/apache/hadoop/fs/FsShell.java | 23 +++++++++++-------- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 529a545f2cf..a5c7b5cbae4 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1162,6 +1162,9 @@ Release 0.21.0 - Unreleased HADOOP-6347. run-test-core-fault-inject runs a test case twice if -Dtestcase is set (cos) + HADOOP-6375. Sync documentation for FsShell du with its implementation. + (Todd Lipcon via cdouglas) + Release 0.20.2 - Unreleased NEW FEATURES diff --git a/src/docs/src/documentation/content/xdocs/file_system_shell.xml b/src/docs/src/documentation/content/xdocs/file_system_shell.xml index bbc0ddca477..54429b0eb6c 100644 --- a/src/docs/src/documentation/content/xdocs/file_system_shell.xml +++ b/src/docs/src/documentation/content/xdocs/file_system_shell.xml @@ -191,10 +191,16 @@
du

- Usage: hdfs dfs -du URI [URI …] + Usage: hdfs dfs -du [-s] [-h] URI [URI …]

- Displays aggregate length of files contained in the directory or the length of a file in case its just a file.
+ Displays sizes of files and directories contained in the given directory or the length of a file in case its just a file.

+

Options:

+ +

Example:
hdfs dfs -du /user/hadoop/dir1 /user/hadoop/file1 hdfs://nn.example.com/user/hadoop/dir1
Exit Code:
Returns 0 on success and -1 on error.

@@ -206,7 +212,7 @@ Usage: hdfs dfs -dus <args>

- Displays a summary of file lengths. + Displays a summary of file lengths. This is an alternate form of hdfs dfs -du -s.

diff --git a/src/java/org/apache/hadoop/fs/FsShell.java b/src/java/org/apache/hadoop/fs/FsShell.java index e3c895b252c..e5501f18825 100644 --- a/src/java/org/apache/hadoop/fs/FsShell.java +++ b/src/java/org/apache/hadoop/fs/FsShell.java @@ -1339,7 +1339,7 @@ public class FsShell extends Configured implements Tool { String summary = "hadoop fs is the command to execute fs commands. " + "The full syntax is: \n\n" + "hadoop fs [-fs ] [-conf ]\n\t" + - "[-D ] [-ls ] [-lsr ] [-df []] [-du ]\n\t" + + "[-D ] [-ls ] [-lsr ] [-df []] [-du [-s] [-h] ]\n\t" + "[-dus ] [-mv ] [-cp ] [-rm [-skipTrash] ]\n\t" + "[-rmr [-skipTrash] ] [-put ... ] [-copyFromLocal ... ]\n\t" + "[-moveFromLocal ... ] [" + @@ -1389,17 +1389,20 @@ public class FsShell extends Configured implements Tool { "\t\tIf the filesystem has multiple partitions, and no path to a particular partition\n"+ "\t\tis specified, then the status of the root partitions will be shown.\n"; - String du = "-du : \tShow the amount of space, in bytes, used by the files that \n" + - "\t\tmatch the specified file pattern. Equivalent to the unix\n" + - "\t\tcommand \"du -sb /*\" in case of a directory, \n" + - "\t\tand to \"du -b \" in case of a file.\n" + + String du = "-du [-s] [-h] : \tShow the amount of space, in bytes, used by the files that \n" + + "\t\tmatch the specified file pattern. The following flags are optional:\n" + + "\t\t -s Rather than showing the size of each individual file that\n" + + "\t\t matches the pattern, shows the total (summary) size.\n" + + "\t\t -h Formats the sizes of files in a human-readable fashion\n" + + "\t\t rather than a number of bytes.\n" + + "\n" + + "\t\tNote that, even without the -s option, this only shows size summaries\n" + + "\t\tone level deep into a directory.\n" + "\t\tThe output is in the form \n" + - "\t\t\tname(full path) size (in bytes)\n"; + "\t\t\tsize\tname(full path)\n"; String dus = "-dus : \tShow the amount of space, in bytes, used by the files that \n" + - "\t\tmatch the specified file pattern. Equivalent to the unix\n" + - "\t\tcommand \"du -sb\" The output is in the form \n" + - "\t\t\tname(full path) size (in bytes)\n"; + "\t\tmatch the specified file pattern. This is equivalent to -du -s above.\n"; String mv = "-mv : Move files that match the specified file pattern \n" + "\t\tto a destination . When moving multiple files, the \n" + @@ -1744,7 +1747,7 @@ public class FsShell extends Configured implements Tool { System.err.println(" [-ls ]"); System.err.println(" [-lsr ]"); System.err.println(" [-df []]"); - System.err.println(" [-du ]"); + System.err.println(" [-du [-s] [-h] ]"); System.err.println(" [-dus ]"); System.err.println(" [" + Count.USAGE + "]"); System.err.println(" [-mv ]");