HDFS Commands: Reference and Examples

HDFS Commands: Reference and Examples

Last updated:
Table of Contents

WIP Alert This is a work in progress. Current information is correct but more content may be added in the future.

Truncate a file

I.e. reduce its size but don't delete it. This is useful to delete large log files, avoiding crashing applications that expect the file to exist.

$ hadoop fs -truncate -w 100 /path/to/file

Touch

It's called touchz in HDFS.

$ hadoop fs -touchz /path/to/file

Dialogue & Discussion