Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
Command Syntax Description Use Case
List Lists files and To view contents in a HDFS
Files/Directories hadoop fs -ls /path directories. directory. Creates a new To create a new directory in Make Directory hadoop fs -mkdir /path directory. HDFS. Remove File hadoop fs -rm /path Deletes a file. To delete a file from HDFS. To remove an empty directory Remove Directory hadoop fs -rmdir /path Deletes a directory. from HDFS. hadoop fs -put localpath To upload a file from local to Copy to HDFS hdfs://path Copies a file to HDFS. HDFS. hadoop fs -get hdfs://path Copies a file from To download a file from HDFS to Copy from HDFS localpath HDFS. local. To view the contents of a file in Display File hadoop fs -cat /path Displays file content. HDFS. Move File hadoop fs -mv /source /dest Moves a file in HDFS. To move a file within HDFS.
hadoop fs -appendToFile Appends to a file in To add more content to an
Append to File localfile hdfs://path HDFS. existing file in HDFS. Displays file system To check the storage usage of Check Usage hadoop fs -df hdfs://path usage. HDFS. hadoop distcp Copy Between hdfs://srcpath Copies files between To migrate or backup data Clusters hdfs://destpath HDFS clusters. between HDFS clusters. hdfs fsck /path -files - Checks the health of To perform health check and File System Check blocks files and blocks. diagnostics on HDFS. To modify read/write/execute Change hadoop fs -chmod 755 Changes file permissions of a file/directory in Permissions /path permissions. HDFS. hadoop fs -chown Changes the owner of To change the owner of a Change Owner user:group /path a file. file/directory in HDFS. Count Counts the number of To get the count of files and Files/Directories hadoop fs -count /path files/directories. directories in a HDFS path. Balances HDFS data To redistribute HDFS data Balancer hdfs balancer across DataNodes. uniformly across DataNodes. To enable/disable HDFS hdfs dfsadmin -safemode Manages HDFS safemode for maintenance or Safemode enter/leave safemode. troubleshooting. Generates HDFS To get a detailed report on the Report hdfs dfsadmin -report cluster report. status of HDFS cluster. Decommission hdfs dfsadmin - Decommissions To remove DataNodes safely Nodes decommission <nodes> DataNodes. from the HDFS cluster.