Hadoop常用的操作命令 列出目录清单 [root@centos67 ~]# hdfs dfs -ls / 递归列出目录清单 [root@centos67 ~]# hdfs dfs -lsr / 创建目录 [root@centos67 ~]# hdfs dfs -mkdir /input/test 删除目录 [root@centos67 ~]# hdfs dfs -rmr /input/test 创建文件 [root@centos67 ~]# hdfs dfs -touchz /input/test/test.txt 文件重命名 [root@centos67 ~]# hdfs dfs -mv /input/test/test.txt /input/test/test.exe 上传文件 [root@centos67 ~]# hdfs dfs -put ./test.log /input/test/ 下载文件 [root@centos67 ~]# hdfs dfs -get /input/test/test.log ./ 查看文件内容 [root@centos67 ~]# hdfs dfs -cat /input/test/test.log 删除文件 [root@centos67 ~]# hdfs dfs -rm /input/test/test.log 复制文件 [root@centos67 ~]# hdfs dfs -cp /input/test/test.log /test.log 统计目录下的所有文件大小 [root@centos67 ~]# hdfs dfs -du /input 统计整个目录大小 [root@centos67 ~]# hdfs dfs -dus /input 将指定目录下所有文件内容保存为一个文件,并且下载到本地 [root@centos67 ~]# hdfs dfs -getmerge /input/test ./test.txt 查看文件的最后1KB内容 [root@centos67 ~]# hdfs dfs /input/test/test.log 修改文件属主属组,可以加-R递归 [root@centos67 ~]# hdfs dfs -chown xiaomo:xiaomo /input/test/test.log 修改文件权限,可以加-R递归 [root@centos67 ~]# hdfs dfs -chmod 700 /input/test/test.log 统计当前文件/目录信息 目录数、文件数、文件大小、文件名/目录名 [root@centos67 ~]# hdfs dfs -count /input/test/test.log 清空回收站,文件被删除时,它首先会移到临时目录.Trash/中, 当超过延迟时间之后,文件才会被永久删除 [root@centos67 ~]# hdfs dfs -expunge [root@centos67 ~]# hdfs dfs -test /input 对/input进行如下类型的检查: -e 是否存在,如果存在,返回0,否则返回1 -z 是否为空,如果长度为0,返回0,否则返回1 -d 是否为目录,如果为目录,返回0,否则返回1 显示文件内容,压缩文件会解压 [root@centos67 ~]# hdfs dfs -text /input/test/test.log 查看某个命令的帮助 [root@centos67 ~]# hdfs dfs -help ls [root@centos67 ~]# hdfs dfs -help touchz 将正在运行的hadoop作业kill掉 [root@centos67 ~]# hdfs job –kill [job-id]
Hadoop常用的操作命令(2)
原创
©著作权归作者所有:来自51CTO博客作者小疯魔的原创作品,请联系作者获取转载授权,否则将追究法律责任
下一篇:CentOS7与6的区别

提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
hadoop HDFS常用文件操作命令
命令基本格式:hadoop fs -cmd < args >1. ls 列出hdfs文件系统根目录下的目录和文件hadoop fs -
hadoop hdfs 大数据 分布式 文件系统 -
hadoop的常用shell命令
hadoop的fs命令
命令 shell hdfs -
Hadoop hdfs文件操作常用命令
hadoop fs -操作命令 -参数-ls #显示目录信息-->hadoop fs
hadoop hdfs 创建目录