Hadoop fs -stat command

0 votes
What does hadoop fs -stat command do?
Jun 13, 2018 in Big Data Hadoop by shams
• 3,670 points
11,295 views

2 answers to this question.

0 votes
Best answer

hadoop fs -stat is as hadoop command used to check the stats of a particular file in the hadoop file system. Suppose I have a folder named Hadoop-folder in the hdfs, then to check the stats of this folder, i would run the command:

hadoop fs -stat /Hadoop-folder

By default, this command returns the date and time when the folder was last updated

The syntax for this command is 

hadoop fs -stat [format] <path>
answered Oct 25, 2018 by Omkar
• 69,220 points

selected Oct 25, 2018 by Omkar

You said "by default", are there other ways to use this? And in the syntax, I am guessing <path> is the path to the file but what is [format]?

Hey there!

Yes, there are other "options" you can use with this command. 

Yes,

 <path> is the path to the file

[format] is used to specify other options. To find out other options, you can run the command:

hadoop fs -help stat

Output:

Usage: hadoop fs -stat [format] <path> ...

Print statistics about the file/directory at <path> in the specified format. 
Format accepts permissions in octal (%a) and symbolic (%A), 
filesize in bytes (%b), type (%F), group name of owner (%g), 
name (%n), block size (%o), replication (%r), 
user name of owner(%u), access date(%x, %X), 
and modification date (%y, %Y). %x and %y show UTC date as “yyyy-MM-dd HH:mm:ss”, 
and %X and %Y show milliseconds since January 1, 1970 UTC. 
If the format is not specified, %y is used by default.
I want to get stats related to more than one options. Right now what I am doing is running the command again and again with different options. Is there a short-cut for this?

Hi. Suppose you want to get more than one stat, you can use multiple options in a single command. For example if you want to get details about file size in bytes (%b) and block size (%o), then the command would be 

hadoop fs -stat %b%o <path>
+1 vote

Hadoop stat returns the stats information of a file. It returns the last updated date and time. The syntax of stat is :

$ hadoop fs -stat /filename

2014-09-28 18:34:06

answered Jun 13, 2018 by Data_Nerd
• 2,390 points

Related Questions In Big Data Hadoop

+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
108,808 views
0 votes
1 answer

The file exists before processing with hadoop command

Took session and it got resolved. READ MORE

answered Dec 18, 2017 in Big Data Hadoop by Sudhir
• 1,570 points
1,040 views
+2 votes
10 answers

Is there any difference between “hdfs dfs” and “hadoop fs” shell commands?

hadoop fs <args> fs is used for generic ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by anonymous
34,030 views
–1 vote
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,350 points
4,609 views
+1 vote
2 answers

What does hadoop fs -du command gives as output?

du command is used for to see ...READ MORE

answered Jul 24, 2019 in Big Data Hadoop by Lokesh Singh
5,857 views
0 votes
1 answer

How can I write text in HDFS using CMD?

Hadoop put & appendToFile only reads standard ...READ MORE

answered Apr 27, 2018 in Big Data Hadoop by Shubham
• 13,490 points
2,276 views
0 votes
1 answer

What is the command to find the free space in HDFS?

You can use dfsadmin which runs a ...READ MORE

answered Apr 29, 2018 in Big Data Hadoop by Shubham
• 13,490 points
2,177 views
0 votes
1 answer

How to find the used cache in HDFS

hdfs dfsadmin -report This command tells fs ...READ MORE

answered May 4, 2018 in Big Data Hadoop by Shubham
• 13,490 points
2,466 views
0 votes
1 answer

Hadoop: What is the difference between `hadoop dfs` and `hadoop fs`?

You can find the definition here: $HADOOP_HOME/bin/hadoop ... elif [ ...READ MORE

answered Nov 6, 2018 in Big Data Hadoop by Omkar
• 69,220 points
1,826 views
0 votes
1 answer

Hadoop: How to use Jps command with Sun JDK installed?

You can put JPS into your path ...READ MORE

answered Nov 9, 2018 in Big Data Hadoop by Omkar
• 69,220 points
1,953 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP