ls

For a file, ls returns stat on the file with the following format:

permissions number_of_replicas userid groupid filesize modification_date modification_time filename

For a directory, ls returns the list of its direct children as in Unix.
A directory is listed as:

permissions userid groupid modification_date modification_time dirname

Files within a directory are ordered by name by default.

Returns 0 on success and -1 on error.

The usage is as follows:

$ hadoop fs -ls [-C] [-d] [-h] [-q] [-R] [-t] [-S] [-r] [-u] [-e] <args>
Arguments

-C

Displays the paths to files and directories only

-d

Directories are listed as plain files

-h

Formats file sizes to the human-readable format (e.g. 64.0m instead of 67108864)

-q

Prints ? instead of non-printable characters

-R

Recursively lists subdirectories encountered

-t

Sorts the output by modification time (most recent first)

-S

Sorts output by file size

-r

Reverses the sort order

-u

Uses access time rather than modification time for display and sorting

-e

Displays the erasure coding policy of files and directories only

Example:

$ hadoop fs -ls /user/hadoop/file1
$ hadoop fs -ls -e /ecdir
Found a mistake? Seleсt text and press Ctrl+Enter to report it