基本格式

hadoop fs -cmd < args >

ls命令,列出目录下的目录和文件

hadoop fs -ls  /

get命令,拷贝文件或目录到本地

hadoop fs -get < hdfs file > < local file or dir>

put

hadoop fs -put < local file > < hdfs file >

copyFromLocal

hadoop fs -copyFromLocal  < local src > ... < hdfs dst >

moveFromLocal

hadoop fs -moveFromLocal  < local src > ... < hdfs dst >

rm命令,删除多个文件或目录

hadoop fs -rm < hdfs file >
hadoop fs -rm -r < hdfs dir>

cp

hadoop fs -cp  < hdfs file >  < hdfs file >

mv

hadoop fs -mv < hdfs file >  < hdfs file >

du 显示hdfs对应路径下每个文件夹和文件的大小

hadoop fs -du < hdsf path> 
hadoop fs -du -s < hdsf path> 
hadoop fs -du - h < hdsf path> 

mkdir

hadoop fs -mkdir < hdfs path>