Hadoop fs -stat command

0 votes
What does hadoop fs -stat command do?
Jun 13, 2018 in Big Data Hadoop by shams
• 3,580 points
1,680 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
• 67,660 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,360 points

Related Questions In Big Data Hadoop

0 votes
10 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyFr ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
16,276 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,610 points
81 views
+2 votes
10 answers

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

Yes, there's a difference between hadoop fs and ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Kunal
10,916 views
0 votes
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,260 points
1,186 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 23 in Big Data Hadoop by Lokesh Singh
1,079 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,300 points
91 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,300 points
227 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,300 points
262 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
• 67,660 points
312 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
• 67,660 points
239 views