Search

hadoop fs -ls

The hadoop ls command is used to list out the directories and files. An example is shown below:
> hadoop fs -ls /user/DPhadoop/employees
Found 1 items
-rw-r--r-- 2 hadoop hadoop 2 2017-01-28 23:37 /user/DPhadoop/employees/000000_0

The above command lists out the files in the employees directory.
> hadoop fs -ls /user/DPhadoop/dir
Found 1 items
drwxr-xr-x - hadoop hadoop 0 2017-02-10 09:47 /user/DPhadoop/dir/products

The output of hadoop fs ls command is almost similar to the unix ls command. The only
difference is in the second field. For a file, the second field indicates the number of replicas and
for a directory, the second field is empty.