HDFS相關命令oop
一、bin/hadoop fs -rm file_name 刪除hdfs上output內的文件spa
或者orm
bin/hadoop dfs -rmr outhadoop
刪除HDFS下名爲out的文檔文檔
bin/hadoop fs -rm -r file 刪除hdfs上output內的文件夾 (路徑要所有,例如:hdfs://localhost:9000/user/root/output/count)input
二、 bin/hadoop dfs -ls 查看hdfs內的文件文件上傳
列HDFS目錄下某個文檔中的文件it
bin/hadooop dfs -ls intest
查看file
#bin/hdfs dfs -cat /user/root/input/file01
查看HDFS下某個文件
bin/hadoop dfs -cat in/*
查看HDFS下in文件中的內容
三、上傳文件到HDFS
bin/hadoop dfs -put test1 test
將hadoop目錄下的test1文件上傳到HDFS上並重命名爲test
把要統計的文本上傳到hdfs的輸入目錄下
# bin/hdfs dfs -put /usr/local/hadoop/hadoop-2.6.0/test/* /user/root/input
//把tes/file01文件上傳到hdfs的/user/root/input中
四、在hdfs上建個文件夾
#bin/hdfs dfs -mkdir –p /user/root/input
hadoop fs -mkdir /user/chen