欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Hadoop 文件系统命令行基础

程序员文章站 2022-06-24 11:05:44
Hadoop 命令行最常用指令篇: 1.ls (list directory) Usage: hadoop fs -ls [R] Option: -R => 递归显示 2.mkdir (make directory) Usage: hadoop fs -mkdir [-p] Take ......

hadoop 命令行最常用指令篇: 

1.ls (list directory) 

usage: hadoop fs -ls [r]

option: -r => 递归显示

Hadoop 文件系统命令行基础

 

2.mkdir (make directory)

usage: hadoop fs -mkdir [-p] <paths>

takes path uri’s as argument and creates directories.

options: -p make parent file => 当给的路径含有不存在的父目录时,递归创建目录

Hadoop 文件系统命令行基础

 

3.put (put local files to hdfs)

usage: hadoop fs -put <localsrc> uri

Hadoop 文件系统命令行基础

 

 

4.get(make directory)

usage: hadoop fs -get uri <localsrc> 

Hadoop 文件系统命令行基础

 

4.rm(remove directory or file)

usage: hadoop fs -rm [-f] [-r |-r]  uri [uri ...]

options:

  • -f => force 强制删除,不给提示。
  • -r |-r => recursively 递归删除所有目录中的文件。  

Hadoop 文件系统命令行基础

warning:    hadoop fs -rm "-rf" 不能连在一起写,需要一个个给出:hadoop fs -rm -r -f

4.mv(move directory or file)

usage: hadoop fs -mv uri [uri ...] <dest>

feature: 支持多个目录或文件移动

Hadoop 文件系统命令行基础