0% found this document useful (0 votes)
3 views6 pages

Book 1

Download as xlsx, pdf, or txt
Download as xlsx, pdf, or txt
Download as xlsx, pdf, or txt
You are on page 1/ 6

Command Syntax Description

List Files/Directories hadoop fs -ls /path Lists files and directories.

Make Directory hadoop fs -mkdir /path Creates a new directory.

Remove File hadoop fs -rm /path Deletes a file.

Remove Directory hadoop fs -rmdir /path Deletes a directory.

hadoop fs -put
Copy to HDFS localpath hdfs://path Copies a file to HDFS.

hadoop fs -get
Copy from HDFS hdfs://path localpath Copies a file from HDFS.

Display File hadoop fs -cat /path Displays file content.

hadoop fs -mv
Move File /source /dest Moves a file in HDFS.

hadoop fs -appendToFile
Append to File localfile hdfs://path Appends to a file in HDFS.
hadoop fs -df
Check Usage hdfs://path Displays file system usage.

hadoop distcp
Copies files between HDFS
Copy Between Clusters hdfs://srcpath
hdfs://destpath clusters.

hdfs fsck /path -files Checks the health of files and


File System Check -blocks blocks.

hadoop fs -chmod 755


Change Permissions /path Changes file permissions.

hadoop fs -chown
Change Owner user:group /path Changes the owner of a file.

Counts the number of


Count Files/Directories hadoop fs -count /path
files/directories.

Balances HDFS data across


Balancer hdfs balancer
DataNodes.
hdfs dfsadmin -safemode
Safemode enter/leave Manages HDFS safemode.

Report hdfs dfsadmin -report Generates HDFS cluster report.

hdfs dfsadmin -
Decommission Nodes decommission <nodes> Decommissions DataNodes.
Use Case

To view contents in a HDFS directory.

To create a new directory in HDFS.

To delete a file from HDFS.

To remove an empty directory from HDFS.

To upload a file from local to HDFS.

To download a file from HDFS to local.

To view the contents of a file in HDFS.

To move a file within HDFS.

To add more content to an existing file in HDFS.


To check the storage usage of HDFS.

To migrate or backup data between HDFS clusters.

To perform health check and diagnostics on HDFS.

To modify read/write/execute permissions of a


file/directory in HDFS.

To change the owner of a file/directory in HDFS.

To get the count of files and directories in a HDFS


path.

To redistribute HDFS data uniformly across


DataNodes.
To enable/disable HDFS safemode for maintenance
or troubleshooting.

To get a detailed report on the status of HDFS


cluster.

To remove DataNodes safely from the HDFS


cluster.

You might also like