Hadoop常用命令

创建目录

hadoop fs -mkdir/input

查看

hadoop fs  -ls

递归查看

hadoop fs ls -R

上传

hadoop fs -put 

下载

hadoop fs -get 

删除

hadoop fs -rm

从本地剪切粘贴到hdfs

hadoop fs -moveFromLocal /input/xx.txt /input/xx.txt

从hdfs剪切粘贴到本地

hadoop fs -moveToLocal /input/xx.txt /input/xx.txt

追加一个文件到另一个文件到末尾

hadoop fs -appedToFile ./hello.txt /input/hello.txt

查看文件内容

hadoop  fs -cat /input/hello.txt

显示一个文件到末尾

hadoop fs -tail /input/hello.txt

以字符串的形式打印文件的内容

hadoop fs -text /input/hello.txt

修改文件权限

hadoop fs -chmod 666 /input/hello.txt

修改文件所属

hadoop  fs -chown user.user  /input/hello.txt

从本地文件系统拷贝到hdfs里

hadoop  fs -copyFromLocal /input/hello.txt /input/

从hdfs拷贝到本地

hadoop  fs -copyToLocal /input/hello.txt /input/

从hdfs到一个路径拷贝到另一个路径

hadoop  fs -cp /input/xx.txt /output/xx.txt

从hdfs到一个路径移动到另一个路径

hadoop  fs -mv /input/xx.txt /output/xx.txt

统计文件系统的可用空间信息

hadoop  fs -df -h /

统计文件夹的大小信息

hadoop  fs -du -s -h /

统计一个指定目录下的文件节点数量

hadoop fs -count /input

设置hdfs的文件副本数量

hadoop  fs -setrep 3 /input/xx.txt


原文地址:https://www.cnblogs.com/lidyan/p/9237932.html