基本格式

1
hadoop fs -cmd < args >

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

1
hadoop fs -ls  /

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

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

put

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

copyFromLocal

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

moveFromLocal

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

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

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

cp

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

mv

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

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

1
2
3
hadoop fs -du < hdsf path> 
hadoop fs -du -s < hdsf path>
hadoop fs -du - h < hdsf path>

mkdir

1
hadoop fs -mkdir < hdfs path>