hadoop ls, lsr commands

Posted at  04:49  |  in  HDFS

ls Command:

      This command is used for listing the contents that match the specified file pattern. The following is the syntax of this command.
  • -ls <path>
In the above syntax, if the path is not specified, this command will list the contents of /user/<currentUser>. If the path is specified then this command will list the contents of specified path. The following figure shows the usage of -ls command on top of HDFS.

Hadoop ls command
Hadoop ls command
In this figure, we did not specified any path, so, the contents of the current directory are listed.

lsr command: 

This command is used to Recursively list the contents that match the specified file pattern. It behaves very similarly to hadoop fs -ls, except that the data is shown for all the entries in the subtree. The following is the systax for lsr command:
  • -lsr <path>
This command also can be used with out specifying the path. The following two figures show the examples:
Hadoop lsr command without path
Hadoop lsr command without path
Hadoop lsr command with path
Hadoop lsr command with path

Share this post

About-Privacy Policy-Contact us
Copyright © 2013 Hadoop Tutor. Blogger Template by Bloggertheme9
Proudly Powered by Blogger.
back to top