Reading and Sampling Data From HDFS

Shell commands on the Hadoop file system are organized similarly to those in Unix/Linux systems. It’s simple to use Hadoop shell commands if you’re familiar with the Unix shell. Earlier posts described commands that interface with HDFS and other Hadoop-supported file systems that are useful in day-to-day tasks. We’ll see about how to read and obtain sample from a file in HDFS console in this post.

Syntax / Examples:
hadoop fs -cat /user/cloudera/EmpDir/emp.txt
The above command will help in displaying the contents of the data from a file.

hadoop fs -tail /user/cloudera/EmpDir/emp.txt
If the file is huge, this is recommended command to see the last few entries of the file.

Hope you find this article helpful.

Please subscribe for more interesting updates.

One comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s