对hdfs操作的命令格式是Hadoop fs/
命令选项。
选项名称使用格式含义
【常用】
-ls -ls <路径> 查看指定路径的当前目录结构
-lsr -lsr <路径> 递归查看指定路径的目录结构
-mkdir -mkdir <hdfs 路径> 创建空白文件夹
-touchz -touchz <文件路径> 创建空白文件
-mv -mv <源路径> <目的路径> 移动
-cp -cp <源路径> <目的路径> 复制
-put -put <多个Linux 上的文件> <hdfs 全路径> 上传文件
-get -get <hdfs 全路径> <linux路径> 下载 hdfs上的文件
-rm -rm [-skipTrash] <路径> 删除文件/空白文件夹
-rmr -rmr [-skipTrash] <全路径> 递归删除
-text -text <hdfs 路径> 查看文件内容
-cat -cat <hdfs 路径> 查看文件内容
-tail -tail [-f] <文件> 查看文件尾部信息
【其他】
-du -du <路径> 统计目录下个文件大小
-dus -dus <路径> 汇总统计目录下文件(夹)大小
-count -count [-q] <路径> 统计文件(夹)数量
-copyFromLocal -copyFromLocal <多个linux 上的文件><hdfs 路径> 从本地复制
-moveFromLocal -moveFromLocal <多个linux 上的文件><hdfs 路径> 从本地移动
-getmerge -getmerge <源路径> <linux 路径> 合并到本地
-copyToLocal -copyToLocal [-ignoreCrc] [-crc] [hdfs 源路径] [linux 目的路径] 从本地复制
-moveToLocal -moveToLocal [-crc] <hdfs 源路径> <linux目的路径> 从本地移动
-setrep -setrep [-R] [-w] <副本数> <路径> 修改副本数量
-stat -stat [format] <路径> 显示文件统计信息
-chmod -chmod [-R] <权限模式> [路径] 修改权限
-chown -chown [-R] [属主][:[属组]] 路径修改属主
-chgrp -chgrp [-R] 属组名称路径修改属组
-help -help [命令选项] 帮助