stat
Prints 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
), username of owner(%u
), access date(%x
, %X
), and modification date (%y
, %Y
).
The %x
and %y
show UTC dates as yyyy-MM-dd HH:mm:ss
, and %X
and %Y
show milliseconds since January 1, 1970 UTC.
If the format isn’t specified, %y
is used by default.
Returns 0
on success and -1
on error.
The usage is as follows:
$ hadoop fs -stat [format] <path> ...
Example:
$ hadoop fs -stat "type:%F perm:%a %u:%g size:%b mtime:%y atime:%x name:%n" /file