Why it matters

Every HDFS problem eventually comes down to two questions: what is the state of the filesystem right now, and how do I change it safely? The dfs and dfsadmin commands together answer both. During an incident, a fluent operator can inspect directory layouts, disk usage, quota consumption, block health, and replication status in seconds. During routine work, the same commands drive daily automation.

Muddling through with only -ls and -cat costs real time. Learning the full command surface is a small up-front investment that pays back on every incident.

Advertisement

The architecture

hdfs dfs is the general user CLI. It mirrors the semantics of Unix commands like ls, du, df, cp, mv, rm, chmod, chown, mkdir, and cat. Every subcommand is prefixed with a dash, and paths use the hdfs:// URI scheme (usually omitted because the default filesystem is HDFS). Operations translate to NameNode RPCs for metadata and streaming reads or writes against DataNodes for data.

hdfs dfsadmin is the administrative CLI. It exposes operations that only a superuser should perform: safe mode control, block report triggering, quota management, DataNode decommissioning, and rolling upgrade coordination. It is the operator's control panel for cluster-wide state.

hdfs dfs — the primary HDFS CLI-ls, -du, -dfinspect-put, -get, -cpmove data-chmod, -chown, -rmmanageAll operations translate to NameNode RPCs (metadata) and DataNode streaming (data)
Every hdfs dfs subcommand is a NameNode RPC plus optional DataNode streaming.
Advertisement

How it works end to end

The inspection subcommands (-ls, -lsr, -du, -df, -count) tell you what is on the filesystem. -du -s -h gives a human-readable subtree size. -count with -q shows quota consumption. -df -h shows overall cluster usage. Master these and you can answer most capacity questions in one command.

Data movement uses -put and -copyFromLocal to write, -get and -copyToLocal to read, and -cp to copy within HDFS. -distcp is a separate command for large cross-cluster copies. -mv is metadata-only within HDFS but requires a rewrite across schemes.

Permission management uses -chmod (mode bits), -chown (owner and group), -setfacl (extended ACLs), and -getfacl to inspect. Quota management moves to dfsadmin: -setQuota, -setSpaceQuota, -clrQuota, -clrSpaceQuota. Deletion uses -rm; the -skipTrash flag bypasses the trash directory and is the source of many accidental data loss stories.