Essential HDFS Shell Commands for Managing Hadoop Distributed File System

Divith Raju
1 min readMar 30, 2024
HDFS SHELL COMMANDS

1)mkdir:
To make a directory
bin/hadoop dfs -mkdir /datagen

2)Copy from Local:
Copy your source file to hdfs
bin/hadoop dfs -copyFromLocal /home/ec2-user/data_10.txt /sample.txt

3)ls:
List all directories
bin/hadoop dfs -ls /

4)lsr:
Recursive version of ls
bin/hadoop dfs -lsr /

5)Copt to Local:
Copy your hdfs file to your local system
bin/hadoop dfs -copyToLocal /sample.txt /home/ec2-user/data_10.txt

6)cp:
Copy files from source to destination in hdfs
bin/hadoop dfs -cp /sample.txt /data_10.txt

7)mv:
Moves files from source to destination in hdfs
bin/hadoop dfs -mv /sample.txt / sample2.txt

8)rm:
Only deletes files
bin/hadoop dfs -rm /sample.txt

9)rmr:
Recursive version of delete. The rmr command recursively deletes the directory and any
content under it
bin/hadoop dfs -rm /datagen

10)tail:
Displays last kilobyte of the file
bin/hadoop dfs -tail /sample.txt

“Thank you for reading! If you enjoyed this article and want to stay updated on my latest insights and projects, feel free to connect with me on LinkedIn.”

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Divith Raju
Divith Raju

Written by Divith Raju

Software Engineer | Data Engineer | Big Data | PySpark |Speaker & Consultant | LinkedIn Top Voices |

No responses yet

Write a response