好程序员大数据教程分享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/*
原创文章,作者:3628473679,如若转载,请注明出处:https://blog.ytso.com/197758.html