HDFS(Hadoop Distributed File System)就是hadoop分布式文件系统,fs是操作HDFS文件的一个常用命令。
1.hadoop fs -help 查看fs使用帮助
2.hadoop fs -mkdir 在HDFS文件系统下的根路径下创建一个文件 这个根目录是独立于虚拟机的

3.hadoop fs -ls 查看文件系统当前目录下的文件

4.hadoop fs -rmdir 删除文件夹

5.hadoop fs -ls -R / 或者 hadoop fs -lsr / 递归显示/目录下的文件

6.hadoop fs -put liunx下的路径 HDFS文件系统路径 Linux上的文件上传到hadoop里面去
hadoop fs -put 1.txt / 就是把当前目录下的1.txt复制到HDFS/下

7.hadoop fs -get HDFS文件系统路径 liunx下的路径 hadoop上的文件上传到Linux里面去
hadoop fs -get /1.txt 就是把HDFS/下的1.txt复制到当前目录下

8.hadoop fs -moveFromLocal 1.txt /lyx02/
hadoop fs -moveFromLocal 1.txt /lyx02/ 就是把当前目录下的1.txt剪切到HDFS/lyx02/下面

9.hadoop fs -cat /1.txt 查看文件内容

10.hadoop fs -tail /1.txt 查看文件结尾内容
11.hadoop fs --chgrp 、-chmod、-chown 和linux文件系统中的用法一样,修改文件所属权限
hadoop fs -chmod 777 /1.txt
hadoop fs -chown root:hadoop101 /1.txt
12.hadoop fs -cp 从HDFS的一个路径拷贝到HDFS的另一个路径
13.hadoop fs -mv 在HDFS移动文件
14.hadoop fs -df -h / 查看HDFS内存使用情况

15.hadoop fs -du -s -h /1.txt 查看文件夹或文件的大小信息

16.hadoop fs -touchz /2.txt 创建一个空文件

17.hadoop fs -count/lyx02 查看某个文件夹下文件数量和大小
