ITPub博客

首页 > 大数据 > Hadoop > 好程序员大数据教程分享HadoopHDFS操作命令总结

好程序员大数据教程分享HadoopHDFS操作命令总结

原创 Hadoop 作者:好程序员IT 时间:2019-11-12 19:24:11 0 删除 编辑

  好程序员大数据教程分享HadoopHDFS 操作命令总结

 

  1. 列出根目录下所有的目录或文件

 

  hadoopfs-ls/

 

  2. 列出 /logs 目录下的所有目录和文件

 

  hadoopfs-ls/logs

 

  3. 列出 /user 目录及其子目录下的所有文件 ( 谨慎使用 )

 

  hadoopfs-ls-R/user

 

  4. 创建 /soft 目录

 

  hadoopfs-mkdir/soft

 

  5. 创建多级目录

 

  hadoopfs-mkdir-p/apps/windows/2017/01/01

 

  6. 将本地的 wordcount.jar 文件上传到 /wordcount 目录下

 

  hadoopfs-putwordcount.jar/wordcount

 

  7. 将 /stu/students.txt 文件拷贝到本地

 

  hadoopfs-copyToLocal/stu/students.txt

 

  8. 将 word.txt 文件拷贝到 /wordcount/input/ 目录

 

  hadoopfs-copyFromLocalword.txt/wordcount/input

 

  9. 将 word.txt 文件从本地移动到 /wordcount/input/ 目录下

 

  hadoopfs-moveFromLocalword.txt/wordcount/input/

 

  10. 将 /stu/students.txt 拷贝一份为 /stu/students.txt.bak

 

  hadoopfs-cp/stu/students.txt/stu/students.txt.bak

 

  11. 将 /flume/tailout/ 目录下的子目录或文件都拷贝到 /logs 目录 ( 如果此目录不存在会创建 ) 下

 

  hadoopfs-cp/flume/tailout//logs

 

  12. 将 /word.txt 文件重命名为 /words.txt

 

  hadoopfs-mv/word.txt/words.txt

 

  13. 将 /words.txt 文件移动到 /wordcount/input/ 目录下

 

  hadoopfs-mv/words.txt/wordcount/input/

 

  14. 将 /ws 目录以及子目录和文件都删除 ( 谨慎使用 )

 

  hadoopfs-rm-r/ws

 

  15. 将 /wordcount/output2/ 目录下的 a.txt 文件删除

 

  hadoopfs-rm/wordcount/output2/a.txt

 

  16. 将 /wordcount/input/ 目录下面的所有文件都删除

 

  hadoopfs-rm/wordcount/input/*

 

  17. 查看 HDFS 集群的磁盘空间使用情况

 

  hadoopfs-df-h

 

  18. 查看 /word.txt 文件的内容

 

  hadoopfs-cat/word.txt

 

  19. 将 name.txt 文件中的内容添加到 /wordcount/input/words.txt 文件中

 

  hadoopfs-appendToFilename.txt/wordcount/words.txt

 

  20. 动态查看 /wordcount/input/words.txt 文件的内容

 

  hadoopfs-tail-f/wordcount/words.txt

 

  21. 统计 /flume 目录总大小

 

  hadoopfs-du-s-h/flume

 

  22. 分别统计 /flume 目录下各个子目录 ( 或文件 ) 大小

 

  hadoopfs-du-s-h/flume/*


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69913892/viewspace-2663789/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
欢迎关注公众号:好程序员特训营 web前端教程分享 723729549 大数据教程分享 703503210

注册时间:2019-03-20

  • 博文量
    539
  • 访问量
    410747