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.