appendToFile
Usage: hadoop fs -appendToFile <localsrc> ... <dst>
将一个或多个文件从本地文件系统追加到目标文件系统中的文件末尾,也可以从stdin读取文件追加到目标文件系统的文件末尾。
Example:
- hadoop fs -appendToFile localFile /user/hadoop/hadoopFile
- hadoop fs -appendToFile localFile1 localFile2 /user/hadoop/hadoopFile
- hadoop fs -appendToFile - /user/hadoop/hadoopFile
[hadoop@jms-master-01 test]$ hadoop fs -appendToFile appendToFileTest /user/hadoop/shell-command-test/appendToFile/appendFile
19/03/28 09:50:35 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[hadoop@jms-master-01 test]$
[hadoop@jms-master-01 test]$ hadoop fs -appendToFile test1 test2 /user/hadoop/shell-command-test/appendToFile/appendFile
19/03/28 09:54:13 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[hadoop@jms-master-01 test]$
cat
Usage: hadoop fs -cat URI [URI ...]
将路径资源复制到stdout中。
Example:
- hadoop fs -cat /user/hadoop/hadoopFile
[hadoop@jms-master-02 test]$ hadoop fs -cat /user/hadoop/shell-command-test/appendToFile/appendFile
19/03/28 15:09:14 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
我是appendToFile命令联系文件,我是第一行。
# hadoop fs -appendToFile appendToFileTest /user/hadoop/tmp/test1
我是一个测试,用来测试appendToFile命令
aaa bbb ccc ddd
eee fff ggg hhh
aaa bbb ccc ddd 111
eee fff ggg hhh 111
[hadoop@jms-master-02 test]$
checksum
Usage: hadoop fs -checksum URI
返回一个文件的checksum信息
Example:
- hadoop fs -checksum /user/hadoop/hadoopFile
[hadoop@jms-master-01 ~]$ hadoop fs -checksum /user/hadoop/input/spark-test.txt
19/03/29 11:26:47 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
/user/hadoop/input/spark-test.txt MD5-of-0MD5-of-512CRC32C 000002000000000000000000a883055136469e1ac85af27b6f0bc040
chgrp
Usage: hadoop fs -chagrp [-R] GROUP URI [URI ...]
改变文件属组,可以通过-R 参数递归修改。
Example:
- hadoop fs -chgrp newGroup /user/hadoop/hadoopFile
- hadoop fs -chgrp new Group /user/hadoop/hadoopDir
[hadoop@jms-master-01 test]$ hadoop fs -chgrp stefan /user/stefan/test1
19/03/29 11:58:52 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[hadoop@jms-master-01 test]$
[hadoop@jms-master-01 test]$
[hadoop@jms-master-01 test]$ hadoop fs -ls /user/stefan
19/03/29 11:58:58 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 2 items
-rw-r--r-- 3 hadoop stefan 32 2019-03-29 11:32 /user/stefan/test1
-rw-r--r-- 3 hadoop supergroup 40 2019-03-29 11:32 /user/stefan/test2
chmod
Usage: hadoop fs -chmod [-R] <MODE[,MODE]... | OCTALMODE> URI [URI ...]
修改文件权限。
[hadoop@jms-master-01 test]$ hadoop fs -ls /user/stefan
19/03/29 11:59:30 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 2 items
-rw-r--r-- 3 hadoop stefan 32 2019-03-29 11:32 /user/stefan/test1
-rw-r--r-- 3 hadoop supergroup 40 2019-03-29 11:32 /user/stefan/test2
[hadoop@jms-master-01 test]$ hadoop fs -chmod 777 /user/stefan/test1
19/03/29 12:02:46 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[hadoop@jms-master-01 test]$ hadoop fs -ls /user/stefan
19/03/29 12:02:52 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 2 items
-rwxrwxrwx 3 hadoop stefan 32 2019-03-29 11:32 /user/stefan/test1
-rw-r--r-- 3 hadoop supergroup 40 2019-03-29 11:32 /user/stefan/test2
chown
Usage: hadoop fs -chown [-R] [OWNER][:[GROUP]] URI [URI]
改变文件的属主。用户必须是超级用户。-R选项递归目录执行。
[hadoop@jms-master-02 test]$ hadoop fs -ls /user/hadoop/shell-command-test/appendToFile
19/04/01 09:29:18 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 3 items
-rw-r--r-- 3 hadoop supergroup 248 2019-03-28 09:54 /user/hadoop/shell-command-test/appendToFile/appendFile
-rw-r--r-- 3 hadoop supergroup 195 2019-03-28 14:02 /user/hadoop/shell-command-test/appendToFile/appendToFile
-rw-r--r-- 3 hadoop supergroup 351 2019-03-28 15:09 /user/hadoop/shell-command-test/appendToFile/stdinFile
[hadoop@jms-master-02 test]$ hadoop fs -chown stefan:stefan /user/hadoop/shell-command-test/appendToFile/stdinFile
19/04/01 09:30:12 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[hadoop@jms-master-02 test]$ hadoop fs -ls /user/hadoop/shell-command-test/appendToFile
19/04/01 09:30:57 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 3 items
-rw-r--r-- 3 hadoop supergroup 248 2019-03-28 09:54 /user/hadoop/shell-command-test/appendToFile/appendFile
-rw-r--r-- 3 hadoop supergroup 195 2019-03-28 14:02 /user/hadoop/shell-command-test/appendToFile/appendToFile
-rw-r--r-- 3 stefan stefan 351 2019-03-28 15:09 /user/hadoop/shell-command-test/appendToFile/stdinFile
[hadoop@jms-master-02 test]$
copyFromLocal
Usage: hadoop fs -copyFromLocal <localsrc> URI
从本地复制文件到hdfs。
[hadoop@jms-master-02 test]$ hadoop fs -copyFromLocal localFile /user/hadoop/shell-command-test/
19/04/01 09:51:25 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[hadoop@jms-master-02 test]$ hadoop fs -cat /user/hadoop/shell-command-test/localFile
19/04/01 09:51:55 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
我是本地文件
copyToLocal
Usage: hadoop fs -copyToLocal [-ignoresrc] [-crc] URI <localdst>
类似于get命令,区别是只限于本地文件系统
[hadoop@jms-master-02 test]$ hadoop fs -copyToLocal /user/hadoop/shell-command-test/localFile /home/hadoop/stefan/test/localFile1
19/04/01 10:00:57 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[hadoop@jms-master-02 test]$ ls
appendFile localFile localFile1
count
Usage:hadoop fs -count [-q] [-h] <paths>
统计和指定文件模式匹配路径下的目录,文件,字节数。
-count参数的输出列:DIR_COUNT, FILE_COUNT, CONTENT_SIZE, PATHNAME
-count -q输出列:QUOTA, REMAINING_QUATA, SPACE_QUOTA, REMAINING_SPACE_QUOTA, DIR_COUNT, FILE_COUNT, CONTENT_SIZE, PATHNAME
-h:将单位转换为可读大小
官网中-v参数已不可用。
[hadoop@jms-master-02 test]$ hadoop fs -count /user/hadoop/shell-command-test/
19/04/01 10:06:07 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
2 4 813 /user/hadoop/shell-command-test
[hadoop@jms-master-02 test]$ hadoop fs -count -q /user/hadoop/shell-command-test/
19/04/01 10:06:22 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
none inf none inf 2 4 813 /user/hadoop/shell-command-test
[hadoop@jms-master-02 test]$ hadoop fs -count -h /user/hadoop/shell-command-test/
19/04/01 10:06:41 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
2 4 813 /user/hadoop/shell-command-test
cp
Usage:hadoop fs -cp [-f] [-p] -p[topax] URI [URI ... ] <dest>
复制文件从源到目的地。该命令复制多个源时,目的地必须是目录。
Options:
- -f:目标文件如果存在则会覆盖。
*-p:保留文件属性[topx](时间戳,所有权,权限,ACL,XAttr)。-p没有指定参数,则保留时间戳,属主和权限。
[hadoop@jms-master-02 test]$ hadoop fs -cp /user/hadoop/shell-command-test/localFile /user/hadoop/shell-command-test/localFile2
19/04/01 10:25:20 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[hadoop@jms-master-02 test]$ hadoop fs -ls /user/hadoop/shell-command-test/
19/04/01 10:25:33 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 3 items
drwxr-xr-x - hadoop supergroup 0 2019-03-28 10:11 /user/hadoop/shell-command-test/appendToFile
-rw-r--r-- 3 hadoop supergroup 19 2019-04-01 09:51 /user/hadoop/shell-command-test/localFile
-rw-r--r-- 3 hadoop supergroup 19 2019-04-01 10:25 /user/hadoop/shell-command-test/localFile2
df
Usage: hadoop fs -df [-h] URI [URI ...]
查看可用空间。
-h:可读模式显示。
[hadoop@jms-master-02 test]$ hadoop fs -df /user/hadoop/
19/04/01 10:32:11 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Filesystem Size Used Available Use%
hdfs://jms-master-01:9000 321944301568 1941774 297705459712 0%
[hadoop@jms-master-02 test]$ hadoop fs -df -h /user/hadoop/
19/04/01 10:32:20 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Filesystem Size Used Available Use%
hdfs://jms-master-01:9000 299.8 G 1.9 M 277.3 G 0%
du
Usage: hadoop fs -du [-s] [-h] URI [URI ...]
显示给定目录中包含的文件和目录的大小,当仅仅是文件时,显示文件的长度。
*-s:汇总显示
*-h:可读模式显示
[hadoop@jms-master-02 test]$ hadoop fs -du /user/hadoop/
19/04/01 10:37:27 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
1506 /user/hadoop/input
54 /user/hadoop/output
870 /user/hadoop/shell-command-test
0 /user/hadoop/我是stdin的输入文字
[hadoop@jms-master-02 test]$ hadoop fs -du -s /user/hadoop/
19/04/01 10:39:18 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
2430 /user/hadoop
[hadoop@jms-master-02 test]$ hadoop fs -du -s -h /user/hadoop/
19/04/01 10:40:07 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
2.4 K /user/hadoop
dus(弃用)
Usage: hadoop fs -dus <args>
显示文件大小。
当前已经被hadoop fs -du -s
命令替换。
find
Usage: hadoop fs -find <path> ... <expression> ...
查找与指定表达式匹配的所有文件,并将选定的操作应用于他们。如果未指定路径,则默认未当前工作目录。如果未指定表达式,则默认未-print。
表达式:
*-name
*-iname(文件名不区分大小写)
*-print
*-print0
*expression -a expression
*expression -and expression
*expression expression
[hadoop@jms-master-02 test]$ hadoop fs -find /user/hadoop -name test*
19/04/01 11:21:41 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
/user/hadoop/input/test1
/user/hadoop/input/test2
get
Usage: hadoop fs -get [-ignorecrc] [-crc] <src> <localdst>
复制文件到本地文件系统。使用-ignorecrc忽略CRC校验失败复制,使用-crc指定通过CRC校验复制。
[hadoop@jms-master-02 test]$ hadoop fs -get -crc /user/hadoop/input/test1 .
19/04/01 11:41:11 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[hadoop@jms-master-02 test]$ ll
总用量 16
-rw-r--r-- 1 hadoop hadoop 32 4月 1 11:41 test1
getfacl
Usage: hadoop fs -getfacl [-R] <path>
显示文件和目录的访问控制列表(ACL)。如果目录具有默认ACL,则getfacl会显示默认的ACL。
*-R选项可以递归列出所有文件和目录的ACL。
hadoop@jms-master-02 test]$ hadoop fs -getfacl /user/hadoop
19/04/01 11:45:10 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
# file: /user/hadoop
# owner: hadoop
# group: supergroup
getfacl: The ACL operation has been rejected. Support for ACLs has been disabled by setting dfs.namenode.acls.enabled to false.
[hadoop@jms-master-02 test]$ hadoop fs -getfacl -R /user/hadoop
19/04/01 11:45:22 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
# file: /user/hadoop
# owner: hadoop
# group: supergroup
getfacl: The ACL operation has been rejected. Support for ACLs has been disabled by setting dfs.namenode.acls.enabled to false.
getfattr
Usage: hadoop fs -getfattr [-R] -n name | -d [-e en] <path>
显示文件或目录的扩展属性名称和值(如果有)。
[hadoop@jms-master-02 test]$ hadoop fs -getfattr -R -n user.myAttr /user/hadoop/shell-command-test/localFile
19/04/01 12:07:42 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
# file: /user/hadoop/shell-command-test/localFile
getmerge
Usage: hadoop fs -getmerge [-nl] <src> <localdst>
将源文件内容写入到本地文件,支持多个源文件合并到本地文件。如果本地文件存在,则会被覆盖。
将test1和test2合并到本地。
[hadoop@jms-master-02 test]$ hadoop fs -cat /user/hadoop/input/test1
19/04/01 14:28:32 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
aaa bbb ccc ddd
eee fff ggg hhh
[hadoop@jms-master-02 test]$ hadoop fs -cat /user/hadoop/input/test2
19/04/01 14:28:36 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
aaa bbb ccc ddd 111
eee fff ggg hhh 111
[hadoop@jms-master-02 test]$ hadoop fs -getmerge -nl /user/hadoop/input/test1 /user/hadoop/input/test2 testmerge
19/04/01 14:26:53 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[hadoop@jms-master-02 test]$ cat testmerge
aaa bbb ccc ddd
eee fff ggg hhh
aaa bbb ccc ddd 111
eee fff ggg hhh 111
ls
Usage: hadoop fs -ls [-d] [-h] [-R] <args>
Options:
*-d:目录列为纯文件
*-h:可读方式格式化文件大小
*-R:递归列出遇到的子目录
[hadoop@jms-master-02 test]$ hadoop fs -ls -R /user/hadoop
19/04/01 14:33:14 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
drwxr-xr-x - hadoop supergroup 0 2019-03-19 16:43 /user/hadoop/input
-rw-r--r-- 3 hadoop supergroup 1434 2019-03-19 16:43 /user/hadoop/input/spark-test.txt
-rw-r--r-- 3 hadoop supergroup 32 2019-03-15 20:14 /user/hadoop/input/test1
-rw-r--r-- 3 hadoop supergroup 40 2019-03-15 20:14 /user/hadoop/input/test2
drwxr-xr-x - hadoop supergroup 0 2019-03-15 20:15 /user/hadoop/output
-rw-r--r-- 3 hadoop supergroup 0 2019-03-15 20:15 /user/hadoop/output/_SUCCESS
-rw-r--r-- 3 hadoop supergroup 54 2019-03-15 20:15 /user/hadoop/output/part-r-00000
drwxr-xr-x - hadoop supergroup 0 2019-04-01 10:27 /user/hadoop/shell-command-test
drwxr-xr-x - hadoop supergroup 0 2019-03-28 10:11 /user/hadoop/shell-command-test/appendToFile
-rw-r--r-- 3 hadoop supergroup 248 2019-03-28 09:54 /user/hadoop/shell-command-test/appendToFile/appendFile
-rw-r--r-- 3 hadoop supergroup 195 2019-03-28 14:02 /user/hadoop/shell-command-test/appendToFile/stdinFile
-rw-r--r-- 3 hadoop supergroup 19 2019-04-01 09:51 /user/hadoop/shell-command-test/localFile
-rw-r--r-- 3 hadoop supergroup 19 2019-04-01 10:25 /user/hadoop/shell-command-test/localFile2
-rw-r--r-- 3 hadoop supergroup 19 2019-04-01 09:51 /user/hadoop/shell-command-test/localFile3
-rw-r--r-- 3 hadoop supergroup 19 2019-04-01 10:27 /user/hadoop/shell-command-test/localFile4
-rw-r--r-- 3 hadoop supergroup 0 2019-03-28 14:04 /user/hadoop/我是stdin的输入文字
mkdir
Usage: hadoop fs -mkdir [-p] <paths>
创建目录。-p:遇到不存在的父目录时,自动创建。
[hadoop@jms-master-02 test]$ hadoop fs -mkdir -p /user/hadoop/mkdir/test/
19/04/01 14:37:25 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[hadoop@jms-master-02 test]$ hadoop fs -ls -R /user/hadoop
drwxr-xr-x - hadoop supergroup 0 2019-03-19 16:43 /user/hadoop/input
-rw-r--r-- 3 hadoop supergroup 1434 2019-03-19 16:43 /user/hadoop/input/spark-test.txt
-rw-r--r-- 3 hadoop supergroup 32 2019-03-15 20:14 /user/hadoop/input/test1
-rw-r--r-- 3 hadoop supergroup 40 2019-03-15 20:14 /user/hadoop/input/test2
drwxr-xr-x - hadoop supergroup 0 2019-04-01 14:37 /user/hadoop/mkdir
drwxr-xr-x - hadoop supergroup 0 2019-04-01 14:37 /user/hadoop/mkdir/test
moveFromLocal
Usage: hadoop fs -moveFromLocal <localsrc> <dst>
和put命令类似,只是在复制后会删除源文件localsrc
[hadoop@jms-master-02 test]$ ls
appendFile localFile localFile1 localFile2 localFile3 test1 testmerge
[hadoop@jms-master-02 test]$ hadoop fs -moveFromLocal testmerge /user/hadoop/mkdir/test
19/04/01 14:41:20 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[hadoop@jms-master-02 test]$ hadoop fs -ls /user/hadoop/mkdir/test
19/04/01 14:41:33 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 1 items
-rw-r--r-- 3 hadoop supergroup 74 2019-04-01 14:41 /user/hadoop/mkdir/test/testmerge
[hadoop@jms-master-02 test]$ ls
appendFile localFile localFile1 localFile2 localFile3 test1
moveToLocal
Usage: hadoop fs -moveToLocal [-crc] <src> <dst>
还未实现的命令(可能以后会实现吧)。
[hadoop@jms-master-02 test]$ hadoop fs -moveToLocal /user/hadoop/mkdir/test/testmerge /home/hadoop/xiepengjie/test
moveToLocal: Option '-moveToLocal' is not implemented yet.
mv
Usage: hadoop fs -mv URI [URI ...] <dest>
移动文件从源到目标。
[hadoop@jms-master-02 test]$ hadoop fs -ls -R /user/hadoop/mkdir
19/04/01 15:10:14 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
drwxr-xr-x - hadoop supergroup 0 2019-04-01 14:41 /user/hadoop/mkdir/test
-rw-r--r-- 3 hadoop supergroup 74 2019-04-01 14:41 /user/hadoop/mkdir/test/testmerge
[hadoop@jms-master-02 test]$ hadoop fs -mv /user/hadoop/mkdir/test/testmerge /user/hadoop/mkdir
19/04/01 15:10:38 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[hadoop@jms-master-02 test]$ hadoop fs -ls -R /user/hadoop/mkdir
19/04/01 15:10:42 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
drwxr-xr-x - hadoop supergroup 0 2019-04-01 15:10 /user/hadoop/mkdir/test
-rw-r--r-- 3 hadoop supergroup 74 2019-04-01 14:41 /user/hadoop/mkdir/testmerge
put
Usage: hadoop fs -put <localsrc> .. <dst>
上传文件到hdfs系统
[hadoop@jms-master-02 test]$ ls
appendFile localFile localFile1 localFile2 localFile3 test1
[hadoop@jms-master-02 test]$ hadoop fs -put test1 /user/hadoop/mkdir/test
19/04/01 15:12:34 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[hadoop@jms-master-02 test]$ hadoop fs -ls -R /user/hadoop/mkdir
19/04/01 15:12:48 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
drwxr-xr-x - hadoop supergroup 0 2019-04-01 15:12 /user/hadoop/mkdir/test
-rw-r--r-- 3 hadoop supergroup 32 2019-04-01 15:12 /user/hadoop/mkdir/test/test1
-rw-r--r-- 3 hadoop supergroup 74 2019-04-01 14:41 /user/hadoop/mkdir/testmerge
rm
Usage: hadoop fs -rm [-f] [-r | -R ] [-skipTrash] URI [URI ...]
删除文件。
Options:
*-f:如果文件不存在,-f参数将不显示诊断消息或修改退出状态以反映错误。
*-R:递归删除
-r:和-R等效
*-skipTrash:跳过垃圾桶并立即删除文件。当需要从超配额目录中删除文件时,可以使用。
[hadoop@jms-master-02 test]$ hadoop fs -rm -r /user/hadoop/mkdir
19/04/01 15:19:58 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
19/04/01 15:20:00 INFO fs.TrashPolicyDefault: Namenode trash configuration: Deletion interval = 0 minutes, Emptier interval = 0 minutes.
Deleted /user/hadoop/mkdir
rmdir
Usage: hadoop fs -rmdir [--ignore-fail-on-non-empty] URI [URI ...]
删除目录。默认情况下目录不为空时删除失败,当指定参数--ignore-fail-on-non-empty时,跳过不为空校验。
[hadoop@jms-master-02 test]$ hadoop fs -rmdir /user/hadoop/input
19/04/01 15:21:39 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
rmdir: `/user/hadoop/input': Directory is not empty
[hadoop@jms-master-02 test]$ hadoop fs -rmdir --ignore-fail-on-non-empty /user/hadoop/input
19/04/01 15:26:26 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
stat
Usage: hadoop fs -stat [ format] <path> ...
[hadoop@jms-master-02 test]$ hadoop fs -stat "%F %u:%g %b %y %n" /user/hadoop/input/test2
19/04/01 15:46:46 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
regular file hadoop:supergroup 40 2019-03-15 12:14:44 test2
tail
Usage: hadoop fs -tail [-f] URI
显示文件的最后一千字节到stdout。-f选项可以将增量输出持续输出到stdout。
test
Usage: hadoop fs -test -[defsz] URI
Options:
*-d:如果是目录,返回0
*-e:如果路径存在,返回0
*-f:如果路径是文件,返回0
*-s:如果路径不为空,返回0
*-z:如果文件长度为0,返回0
touchz
Usage: hadoop fs -touchz URI [URI ...]
创建一个空文件。
[hadoop@jms-master-02 test]$ hadoop fs -touchz /user/hadoop/input/_SUCCESS
19/04/01 16:10:38 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[hadoop@jms-master-02 test]$ hadoop fs -ls /user/hadoop/input
19/04/01 16:10:49 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 4 items
-rw-r--r-- 3 hadoop supergroup 0 2019-04-01 16:10 /user/hadoop/input/_SUCCESS