start HadoopEnter the Hadoop_home directory. Execute SH bin/start-all.sh
Turn off HadoopEnter the Hadoop_home directory. Execute SH bin/stop-all.sh
1. View content in the specified directory
Hadoop dfs–ls [File directory]
Eg:hadoop dfs–ls/user/wangkai.pt
2. Open an existing file
Hadoop Dfs–cat [File_path]
Eg:hadoop Dfs-cat/user/wangkai.pt/data.txt
3. Store local files to Hadoop
Hadoop fs–put [Local address] [Hadoop directory]
Hadoop fs–put/home/t/file.txt/user/t
(File.txt is the file name)
4. Store the local folder to Hadoop
Hadoop fs–put [local directory] [Hadoop directory]
Hadoop fs–put/home/t/dir_name/user/t
(Dir_name is the folder name)
5. Down a file on Hadoop to a local existing directory
Hadoop fs-get [File directory] [local directory]
Hadoop fs–get/user/t/ok.txt/home/t
6. Delete specified files on Hadoop
Hadoop fs–rm [File address]
Hadoop fs–rm/user/t/ok.txt
7. Delete the specified folder (including subdirectories, etc.) on Hadoop
Hadoop fs–rm [Directory address]
Hadoop fs–rmr/user/t
8. Create a new directory within the Hadoop specified directory
Hadoop fs–mkdir/user/t
9. Create a new empty file under the Hadoop specified directory
Use the TOUCHZ command:
Hadoop fs-touchz/user/new.txt
10. Renaming a file on Hadoop
Using the MV command:
Hadoop fs–mv/user/test.txt/user/ok.txt (renaming test.txt to Ok.txt)
11. Save all contents of the Hadoop directory as a file and down to the local
Hadoop dfs–getmerge/user/home/t
12. Kill the running Hadoop job
Hadoop Job–kill [Job-id]