Hadoop2 HDFS shell命令
1. hdfs dfs -appendToFile <localsrc> ... <dst>
可同时上传多个文件到HDFS里面
2. hdfs dfs -cat URI [URI ...]
查看文件内容
3. hdfs dfs -chgrp [-R] GROUP URI [URI ...]
修改文件所属组
4. hdfs dfs -chmod [-R] <MODE[,MODE]... | OCTALMODE> URI [URI ...]
修改文件权限
5. hdfs dfs -chown [-R] [OWNER][:[GROUP]] URI [URI ]
修改文件所有者,文件所属组,其他用户的读、写、执行权限
6. hdfs dfs -copyFromLocal <localsrc> URI
复制文件到hdfs
7. hdfs dfs -copyToLocal [-ignorecrc] [-crc] URI <localdst>
复制文件到本地
8. hdfs dfs -count [-q] <paths>
统计文件及文件夹数目
9. hdfs dfs -cp [-f] URI [URI ...] <dest>
Hadoop HDFS 文件系统间的文件复制
10. hdfs dfs -du [-s] [-h] URI [URI ...]
统计目录下的文件及大小
11. hdfs dfs -dus <args>
汇总目录下的文件总大小
12. hdfs dfs -expunge
清空回收站,文件被删除时,它首先会移到临时目录.Trash/中,当超过延迟时间之后,文件才会被永久删除
13. hdfs dfs -get [-ignorecrc] [-crc] <src> <localdst>
下载文件到本地
14. hdfs dfs -getfacl [-R] <path>
查看ACL (访问权限组拥有者)
15. hdfs dfs -getmerge <src> <localdst> [addnl]
合并下载文件到本地
16. hdfs dfs -ls <args>
查看目录
17. hdfs dfs -lsr <args>
循环列出目录、子目录及文件信息
18. hdfs dfs -mkdir [-p] <paths>
创建空白文件夹
19. dfs -moveFromLocal <localsrc> <dst>
剪切文件到hdfs
20. hdfs dfs -moveToLocal [-crc] <src> <dst>
剪切文件到本地
21. hdfs dfs -mv URI [URI ...] <dest>
剪切hdfs文件
22. hdfs dfs -put <localsrc> ... <dst>
上传文件
23. hdfs dfs -rm [-skipTrash] URI [URI ...]
删除文件/空白文件夹
24. hdfs dfs -rmr [-skipTrash] URI [URI ...]
递归删除 删除文件及文件夹下的所有文件
25. hdfs dfs -setfacl [-R] [-b|-k -m|-x <acl_spec> <path>]|[--set <acl_spec> <path>]
Sets Access Control Lists (ACLs) of files and directories.
Options:
- -b: Remove all but the base ACL entries. The entries for user, group and others are retained for compatibility with permission bits.
- -k: Remove the default ACL.
- -R: Apply operations to all files and directories recursively.
- -m: Modify ACL. New entries are added to the ACL, and existing entries are retained.
- -x: Remove specified ACL entries. Other ACL entries are retained.
- --set: Fully replace the ACL, discarding all existing entries. The acl_spec must include entries for user, group, and others for compatibility with permission bits.
- acl_spec: Comma separated list of ACL entries.
- path: File or directory to modify.
Examples:
- hdfs dfs -setfacl -m user:hadoop:rw- /file
- hdfs dfs -setfacl -x user:hadoop /file
- hdfs dfs -setfacl -b /file
- hdfs dfs -setfacl -k /dir
- hdfs dfs -setfacl --set user::rw-,user:hadoop:rw-,group::r--,other::r-- /file
- hdfs dfs -setfacl -R -m user:hadoop:r-x /dir
- hdfs dfs -setfacl -m default:user:hadoop:r-x /dir
Exit Code:
Returns 0 on success and non-zero on error.
26. hdfs dfs -setrep [-R] [-w] <numReplicas> <path>
修改副本数
27. hdfs dfs -stat URI [URI ...]
显示文件统计信息
28. hdfs dfs -tail [-f] URI
查看文件尾部信息
29. hdfs dfs -test -[ezd] URI
对PATH进行如下类型的检查:
-e PATH是否存在,如果PATH存在,返回0,否则返回1
-z 文件是否为空,如果长度为0,返回0,否则返回1
-d 是否为目录,如果PATH为目录,返回0,否则返回1
30. hdfs dfs -text <src>
查看文件内容
31. hdfs dfs -touchz URI [URI ...]
创建长度为0的空文件
相关推荐
Hadoop环境搭建和HDFS Shell命令 ppt格式 内容丰富生动
hadoop(二:hadoop3.3.0搭建,HDFS shell 命令,MapReduce程序)
(1) HDFS 2.0应用场景、原理、基本架构及使用方法.pdf (2) HDFS 2.0实战—Shell命令使用.pdf (3) Understanding_Hadoop_Clusters_and_the_Network.pdf 《 HDFS应用场景、部署、原理与基本架构》作业.pdf 《 YARN应用...
Compatibilty between Hadoop 1.x and Hadoop 2.x Encrypted Shuffle Pluggable Shuffle/Sort Distributed Cache Deploy MapReduce REST APIs MR Application Master MR History Server YARN Overview YARN ...
Hadoop HDFS_Shell命令详解
HDFS的Shell操作,bin/hadoop fs 具体命令 OR bin/hdfs dfs 具体命令 dfs是fs的实现类等等。
Hadoop框架之HDFS的shell操作Hadoop框架之HDFS的shell操作Hadoop框架之HDFS的shell操作Hadoop框架之HDFS的shell操作
3. 练习 HDFS Shell 文件系统命令和系统管理命令。 4. 在 Hadoop 集群主节点上搭建 HDFS 开发环境 Eclipse。 5. 使用 HDFS Java API 编写 HDFS 文件操作程序,实现上传本地文件到 HDFS 的功能。。。。。
适合刚接触hadoop的学生或小白,内容包括HDFS shell操作及HDFS Java API编程 有图片有代码
大数据与云计算教程课件 优质大数据课程 07.HDFS Shell命令(共21页).pptx 大数据与云计算教程课件 优质大数据课程 08.HDFS文件接口(共41页).pptx 大数据与云计算教程课件 优质大数据课程 09.MapReduce序列化(共...
一、Shell命令实现 第一步,启动Hadoop: start-dfs.sh 第二步,检测文件或目录是否存在: hdfs dfs -test -e 文件或目录名 第三步,查看检测结果: echo $? 若输出结果为0,则说明文件或目录存在,若为1,则说明...
07.HDFS Shell命令 08.HDFS文件接口 09.MapReduce序列化 10.MapReduce MP过程进阶 11.MapReduce IO操作 12.序列化框架 13.深入MapReduce应用开发 14.Hadoop集群配置 15.Hive 16.Hive操作 17.Hive查询 18.HBase 19....
1. 编程实现以下指定功能,并利用 Hadoop 提供的 Shell 命令完成相同任务: 2. 编程实现一个类“MyFSDataInputStream”,该类继承“org.apache.hadoop.fs.FSDataInputStream”,要求如下:实现按行读取 HDFS 中指定...
A.2实验二:熟悉常用的HDFS操作 本实验对应第4章的内容。 A.2.1 实验目的 (1)理解 HDFS在Hadoop体系结构中的角色。(2)熟练使用HDFS操作常用的 Shell命令。(3)熟悉HDFS操作常用的Java API。 A.2.2 实验平台 (1)操作...
07.HDFS Shell命令 08.HDFS文件接口 09.MapReduce序列化 10.MapReduce MP过程进阶 11.MapReduce IO操作 12.序列化框架 13.深入MapReduce应用开发 14.Hadoop集群配置 15.Hive 16.Hive操作 17.Hive查询 18.HBase 19....
07.HDFS Shell命令 08.HDFS文件接口 09.MapReduce序列化 10.MapReduce MP过程进阶 11.MapReduce IO操作 12.序列化框架 13.深入MapReduce应用开发 14.Hadoop集群配置 15.Hive 16.Hive操作 17.Hive查询 18.HBase 19....
07.HDFS Shell命令 08.HDFS文件接口 09.MapReduce序列化 10.MapReduce MP过程进阶 11.MapReduce IO操作 12.序列化框架 13.深入MapReduce应用开发 14.Hadoop集群配置 15.Hive 16.Hive操作 17.Hive查询 18.HBase 19....
2. 熟练使用HDFS操作常用的Shell命令; 3. 熟悉HDFS操作常用的Java API。 二、实验平台 1. 操作系统:Linux(建议Ubuntu16.04或Ubuntu18.04); 2. Hadoop版本:3.1.3; 3. JDK版本:1.8; 4. Java IDE:Eclipse。 ...
HDFS 常用 shell 命令 1. 显示当前目录结构