0% found this document useful (0 votes)
70 views3 pages

HDFS Sample COmmands

This document lists Hadoop commands for manipulating data in HDFS. It describes commands for listing directories, creating/deleting files and directories, copying/moving files between directories, setting file replication, and checking filesystem health and statistics. Examples are provided for commands like put, get, ls, mkdir, rm, cp, and mv to load, access, organize, and delete files in HDFS.

Uploaded by

suvil sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views3 pages

HDFS Sample COmmands

This document lists Hadoop commands for manipulating data in HDFS. It describes commands for listing directories, creating/deleting files and directories, copying/moving files between directories, setting file replication, and checking filesystem health and statistics. Examples are provided for commands like put, get, ls, mkdir, rm, cp, and mv to load, access, organize, and delete files in HDFS.

Uploaded by

suvil sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Hadoop Commands to Manipulate Data

1 hadoop fs –ls /

2. hadoop fs –mkdir /new >hadoop fs –ls /

Create File In Local Mode and Dump To HDFS:


cat> file1.txt 

Hi… This is Big Data & Hadoop Admin Commands

cat file1.txt

cat> file2.txt 

Hello, welcome to the world of hadoop.

3. hadoop fs –put file1.txt /

4. hadoop fs –cat /file1.txt

4. hadoop fs –put file2.txt /

5. hadoop fs –put file1.txt /new

6. hadoop fs –ls /new

7. hadoop fs –cat /new/file1.txt

Delete File From HDFS:


8. hadoop fs –rm /file1.txt

9. hadoop fs –rm /new/file1.txt

10. hadoop fs –ls /

cat> file3.txt

Time is money….

cat > file4.txt

yes, tine is money…..


11. hadoop fs –put file3.txt /

12. Hadoop fs –put file4.txt /

13. hadoop fs –cp /file3.txt /file4.txt

14. hadoop fs –mkdir /new1 hadoop fs –mkdir /new2

cat> test1.txt  Time is money…

cat> test2.txt  Yes.. time is money…

15. hadoop fs –put test1.txt /

hadoop fs –cp /test1.txt /new1

or

hadoop fs –mv /test1.txt /new1

16. hadoop fs –put test2.txt /

hadoop fs –cp /test2.txt /new2

hadoop fs –mv b.txt /new2

17. hadoop fs –mkdir /new3

hadoop fs –mkdir /new4

18. hadoop fs –cp /new1/test1.txt /new3

hadoop fs –mv /new2/test2.txt /new4

Delete The Directory From HDFS:


19. hadoop fs –rmr /new1 hadoop fs –rmr /new2

HADOOP ADMINISTRATION COMMANDS:

Hadoop Safe Mode (Maintenance Mode) Commands

hadoop dfsadmin -safemode enter Enter safe mode


hadoop dfsadmin -safemode leave Leave safe mode

Set The Replication:

22. hadoop fs –set rep 5 /new2/test2.txt

23. hadoop fsck -move [move corrupted files to /lost directory]

24. hadoop fsck -delete [delete corrupted files]

25. hadoopfsck-blocks [prints block reports]

25. hadoopfsck-racks [prints network topology with rack information]

26. hadoop balancer [cluster balancing utility]

27. hadoop dfsadmin –report [reports basic filesystem information statastics]

28. hadoop fs -du /[displays size of the file & directory in the current

directory]

29. hadoop fs –dus / [displays aggregate summary of files in directory]

30. hadoop fs –count / [displays the contents of directory]

31. hadoopdfsadmin -refreshNodes

You might also like