Hadoop Frequently Used Commands

TaskCommand
List fileshdfs dfs -ls /path/
List files recursivelyhdfs dfs -ls -R /path/
Create a directoryhdfs dfs -mkdir /path/
Create parent directorieshdfs dfs -mkdir -p /parent/child/
Upload file to HDFShdfs dfs -put localfile /hdfs/path/
Download file from HDFShdfs dfs -get /hdfs/path localfile
Copy file within HDFShdfs dfs -cp /src /dest
Move file within HDFShdfs dfs -mv /src /dest
Remove file or dirhdfs dfs -rm /path/file.txt
Remove directory recursivelyhdfs dfs -rm -r /path/dir
Display contents of a filehdfs dfs -cat /file/path
Show file statisticshdfs dfs -stat /file/path
Show disk usagehdfs dfs -du /path/
Count files, directories, and byteshdfs dfs -count /path/
Change file permissionshdfs dfs -chmod 755 /path/
Change file ownerhdfs dfs -chown user:group /path/
List all files based on size in decending orderhdfs dfs -ls -R / | grep -v ‘^d’ | awk ‘{print $5, $8}’ | sort -nr

Leave a Reply

Your email address will not be published. Required fields are marked *