text
将源文件输出为文本格式。允许的格式是zip和TextRecordInputStream。
hadoop fs -text
test
hadoop fs -test -[ezd]
-e 检查文件是否存在。如果存在则返回0。
-z 检查文件是否是0字节。如果是则返回0。
-d 如果路径是个目录,则返回1,否则返回0。
rmr
递归删除
hadoop fs -rmr
put
将本地文件上传至HDFS
hadoop fs -put
get
复制HDFS文件到本地文件系统
hadoop fs -get
touchz
创建一个0字节的空文件
hadoop -touchz pathname…
cat
将路径指定文件的内容输出到stdout。
hadoop fs -cat URI [URI …]
hadoop fs -cat hdfs://host1:port1/file1 hdfs://host2:port2/file2
hadoop fs -cat file:///file3 /user/hadoop/file4
copyFromLocal
除了限定源路径是一个本地文件外,和put命令相似。
hadoop fs -copyFromLocal URI
copyToLocal
除了限定目标路径是一个本地文件外,和get命令类似。
hadoop fs -copyToLocal [-ignorecrc] [-crc] URI
cp
将文件从源路径复制到目标路径。这个命令允许有多个源路径,此时目标路径必须是一个目录。
hadoop fs -cp /user/hadoop/file1 /user/hadoop/file2
hadoop fs -cp /user/hadoop/file1 /user/hadoop/file2 /user/hadoop/dir
du
显示目录中所有文件的大小,或者当只指定一个文件时,显示此文件的大小。
hadoop fs -du /user/hadoop/dir1 /user/hadoop/file1 hdfs://host:port/user/hadoop/dir1
dus
显示文件的大小
hadoop fs -dus
————Blueicex 2020/2/10 9:10 [email protected]