TEJASHWINI s
TEJASHWINI s

Reputation: 25

View contents of a file in HDFS

I'm running this command:

hadoop fs -ls /tej/

This is the output:

-rw-r--r--   1 hduser supergroup   19 2016-02-19 18:46 /tej/t1.txt

Could you please tell me how to display the contents present in t1.txt?

I tried the cat command but couldn't display the content present in the file.

Upvotes: 1

Views: 8711

Answers (2)

TayTay
TayTay

Reputation: 7170

You've got a few options...

View tail:

hadoop fs -tail /tej/t1.txt

View head:

hadoop fs -cat /tej/t1.txt | head

View entire file:

hadoop fs -cat /tej/t1.txt

Upvotes: 3

Mobin Ranjbar
Mobin Ranjbar

Reputation: 1360

The only way to see the content of a file is hadoop fs -cat /path/to/your/file. In the path, you have to provide the path to file and not folder. I think you used hadoop fs -cat /tej/ that will not work.

Upvotes: 1

Related Questions