Good programmer big data tutorials share summary of HadoopHDFS operation commands
Good programmer big data tutorials share summary of HadoopHDFS operation commands
1. List all directories or files under the root directory
Hadoopfs-ls/
two。 List all directories and files under the / logs directory
Hadoopfs-ls/logs
3. List all files in the / user directory and its subdirectories (use with caution)
Hadoopfs-ls-R/user
4. Create / soft directory
Hadoopfs-mkdir/soft
5. Create a multi-level directory
Hadoopfs-mkdir-p/apps/windows/2017/01/01
6. Upload the local wordcount.jar file to the / wordcount directory
Hadoopfs-putwordcount.jar/wordcount
7. Copy the / stu/students.txt file locally
Hadoopfs-copyToLocal/stu/students.txt
8. Copy the word.txt file to the / wordcount/input/ directory
Hadoopfs-copyFromLocalword.txt/wordcount/input
9. Move the word.txt file locally to the / wordcount/input/ directory
Hadoopfs-moveFromLocalword.txt/wordcount/input/
10. Make a copy of / stu/students.txt as / stu/students.txt.bak
Hadoopfs-cp/stu/students.txt/stu/students.txt.bak
11. Copy the subdirectories or files under the / flume/tailout/ directory to the / logs directory (if this directory does not exist, it will be created)
Hadoopfs-cp/flume/tailout//logs
twelve。 Rename the / word.txt file to / words.txt
Hadoopfs-mv/word.txt/words.txt
13. Move the / words.txt file to / wordcount/input/ directory
Hadoopfs-mv/words.txt/wordcount/input/
14. Delete the / ws directory as well as subdirectories and files (use with caution)
Hadoopfs-rm-r/ws
15. Delete the a.txt file in the / wordcount/output2/ directory
Hadoopfs-rm/wordcount/output2/a.txt
16. Delete all files under the / wordcount/input/ directory
Hadoopfs-rm/wordcount/input/*
17. View the disk space usage of the HDFS cluster
Hadoopfs-df-h
18. View the contents of the / word.txt file
Hadoopfs-cat/word.txt
19. Add the contents of the name.txt file to the / wordcount/input/words.txt file
Hadoopfs-appendToFilename.txt/wordcount/words.txt
20. Dynamically view the contents of the / wordcount/input/words.txt file
Hadoopfs-tail-f/wordcount/words.txt
21. Total size of statistics / flume directory
Hadoopfs-du-s-h/flume
twenty-two。 Count the size of each subdirectory (or file) under the / flume directory respectively
Hadoopfs-du-s-h/flume/*