新建目录

hdfs dfs -mkdir -p /input/

上传目录

hdfs dfs -put /path/to/local/mobile.txt /input/

下载文件

hdfs dfs -get /input/mobile.txt /root

移动文件

hdfs dfs -mv /input/mobile.txt /user/hive/warehouse

验证文件上传

hdfs dfs -ls /input/

查看文件内容

hdfs dfs -cat /input/mobile.txt

删除文件

hdfs dfs -rm /input/mobile.txt

删除文件夹

hdfs dfs -rm -r -f /result

查看权限

hdfs dfs -ls /input

修改权限

hdfs dfs -chmod 755 /input

查看文件前十行

hdfs dfs -cat /input/mobile.txt | head -n 10

查看文件后十行

hdfs dfs -cat /input/mobile.txt | tail -n 10

显示文件大小

hdfs dfs -du -h /student

显示文件大小

hdfs dfs -du /student/mobile.txt

列出 HDFS 的文件和目录

hdfs dfs -ls / hdfs dfs -ls -R /