Book Image

Cloudera Administration Handbook

By : Rohit Menon
Book Image

Cloudera Administration Handbook

By: Rohit Menon

Overview of this book

Table of Contents (17 chapters)
Cloudera Administration Handbook
Credits
Notice
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Exploring HDFS commands


To perform filesystem related tasks, the commands begin with hdfs dfs. The filesystem commands have been designed to behave similarly to the corresponding Unix/Linux filesystem commands.

What is a URI? URI stands for Uniform Resource Identifier. In the commands that are listed as follows, you will observe the use of URI for file locations. The URI syntax to access a file in HDFS is hdfs://namenodehost/parent/child/<file>.

Commonly used HDFS commands

The following are some of the most commonly used HDFS commands:

  • ls: This command lists files in HDFS.

    The syntax of the ls command is hdfs dfs -ls <args>. The following is the screenshot showing an example of the ls command:

  • cat: This command displays the contents of file/files in the terminal.

    The syntax of the cat command is hdfs dfs -cat URI [URI …]. The following is a sample output of the cat command:

  • copyFromLocal: This command copies a file/files from the local filesystem to HDFS.

    The syntax of the copyFromLocal...