Saturday, 2 January 2016

Hadoop: ls: lists all the files in HDFS directory

If you pass directory as an argument to the ls command, it lists all files in that directory. If you pass file name as an argument to the ls command, it displays statistics on the file in below format.

permissions number_of_replicas userid groupid filesize modification_date modification_time filename



Usage:
hadoop fs [generic options] -ls [-d] [-h] [-R] [<path> ...]

Options
-d: Directories are listed as plain files.
-h: Format file sizes in a human-readable fashion (eg 64.0m instead of 67108864).
-R: Recursively list subdirectories encountered.

[cloudera@quickstart ~]$ hadoop fs -ls /
Found 6 items
drwxrwxrwx   - hdfs  supergroup          0 2017-10-23 09:15 /benchmarks
drwxr-xr-x   - hbase supergroup          0 2022-03-22 02:36 /hbase
drwxr-xr-x   - solr  solr                0 2017-10-23 09:18 /solr
drwxrwxrwt   - hdfs  supergroup          0 2022-03-22 02:20 /tmp
drwxr-xr-x   - hdfs  supergroup          0 2017-10-23 09:17 /user
drwxr-xr-x   - hdfs  supergroup          0 2017-10-23 09:17 /var
'ls' command list all the files in the dictionary order of their name. You can confirm the same from above output.

Previous                                                 Next                                                 Home

No comments:

Post a Comment