首页 > 其他 > 详细

bin/hdfs dfs命令

时间:2019-03-14 16:15:48      阅读:210      评论:0      收藏:0      [点我收藏+]

appendToFile

Usage:?hdfs dfs -appendToFile <localsrc> ... <dst>

追加一个或者多个文件到hdfs制定文件中.也可以从命令行读取输入.

Exit Code:

Returns 0 on success and 1 on error.

cat

Usage:?hdfs dfs -cat URI [URI ...]

查看内容.

Example:

Exit Code:

Returns 0 on success and -1 on error.

Chgrp【change group】

Usage:?hdfs dfs -chgrp [-R] GROUP URI [URI ...]

修改所属组.

Options

chmod

Usage:?hdfs dfs -chmod [-R] <MODE[,MODE]... | OCTALMODE> URI [URI ...]

修改权限.

Options

chown

Usage:?hdfs dfs -chown [-R] [OWNER][:[GROUP]] URI [URI ]

修改所有者.

Options

copyFromLocal

Usage:?hdfs dfs -copyFromLocal <localsrc> URI

Similar to put command, except that the source is restricted to a local file reference.

Options:

copyToLocal

Usage:?hdfs dfs -copyToLocal [-ignorecrc] [-crc] URI <localdst>

Similar to get command, except that the destination is restricted to a local file reference.

count

Usage:?hdfs dfs -count [-q] [-h] <paths>

列出文件夹数量、文件数量、内容大小. The output columns with -count are: DIR_COUNT, FILE_COUNT, CONTENT_SIZE FILE_NAME

The output columns with -count -q are: QUOTA, REMAINING_QUATA, SPACE_QUOTA, REMAINING_SPACE_QUOTA, DIR_COUNT, FILE_COUNT, CONTENT_SIZE, FILE_NAME

The -h option shows sizes in human readable format.

Example:

Exit Code:

Returns 0 on success and -1 on error.

cp

Usage:?hdfs dfs -cp [-f] [-p | -p[topax]] URI [URI ...] <dest>

复制文件(),可以覆盖,可以保留原有权限信息

Options:

Example:

Exit Code:

Returns 0 on success and -1 on error.

du

Usage:?hdfs dfs -du [-s] [-h] URI [URI ...]

显示文件()大小.

Options:

Example:

Exit Code: Returns 0 on success and -1 on error.

dus

Usage:?hdfs dfs -dus <args>

Displays a summary of file lengths.

Note:?This command is deprecated. Instead use?hdfs dfs -du -s.

expunge

Usage:?hdfs dfs -expunge

清空回收站.

get

Usage:?hdfs dfs -get [-ignorecrc] [-crc] <src> <localdst>

Copy files to the local file system. Files that fail the CRC check may be copied with the -ignorecrc option. Files and CRCs may be copied using the -crc option.

Example:

Exit Code:

Returns 0 on success and -1 on error.

getfacl

Usage:?hdfs dfs -getfacl [-R] <path>

显示权限信息.

Options:

Examples:

Exit Code:

Returns 0 on success and non-zero on error.

getfattr

Usage:?hdfs dfs -getfattr [-R]?-n name | -d?[-e en] <path>

Displays the extended attribute names and values (if any) for a file or directory.

Options:

Examples:

Exit Code:

Returns 0 on success and non-zero on error.

getmerge

Usage:?hdfs dfs -getmerge <src> <localdst> [addnl]

合并.

ls

Usage:?hdfs dfs -ls [-R] <args>

Options:

For a file returns stat on the file with the following format:

permissions number_of_replicas userid groupid filesize modification_date modification_time filename
			

For a directory it returns list of its direct children as in Unix. A directory is listed as:

permissions userid groupid modification_date modification_time dirname
			

Example:

Exit Code:

Returns 0 on success and -1 on error.

lsr

Usage:?hdfs dfs -lsr <args>

Recursive version of ls.

Note:?This command is deprecated. Instead use?hdfs dfs -ls -R

mkdir

Usage:?hdfs dfs -mkdir [-p] <paths>

Takes path uri‘s as argument and creates directories.

Options:

Example:

Exit Code:

Returns 0 on success and -1 on error.

moveFromLocal

Usage:?hdfs dfs -moveFromLocal <localsrc> <dst>

Similar to put command, except that the source localsrc is deleted after it‘s copied.

moveToLocal

Usage:?hdfs dfs -moveToLocal [-crc] <src> <dst>

Displays a "Not implemented yet" message.

mv

Usage:?hdfs dfs -mv URI [URI ...] <dest>

Moves files from source to destination. This command allows multiple sources as well in which case the destination needs to be a directory. Moving files across file systems is not permitted.

Example:

Exit Code:

Returns 0 on success and -1 on error.

put

Usage:?hdfs dfs -put <localsrc> ... <dst>

Copy single src, or multiple srcs from local file system to the destination file system. Also reads input from stdin and writes to destination file system.

Exit Code:

Returns 0 on success and -1 on error.

rm

Usage:?hdfs dfs -rm [-f] [-r|-R] [-skipTrash] URI [URI ...]

Delete files specified as args.

Options:

Example:

Exit Code:

Returns 0 on success and -1 on error.

rmr

Usage:?hdfs dfs -rmr [-skipTrash] URI [URI ...]

Recursive version of delete.

Note:?This command is deprecated. Instead use?hdfs dfs -rm -r

setfacl

Usage:?hdfs dfs -setfacl [-R] [-b|-k?-m|-x <acl_spec>?<path>]|[--set <acl_spec> <path>]

Sets Access Control Lists (ACLs) of files and directories.

Options:

Examples:

Exit Code:

Returns 0 on success and non-zero on error.

setfattr

Usage:?hdfs dfs -setfattr?-n name [-v value] | -x name?<path>

Sets an extended attribute name and value for a file or directory.

Options:

Examples:

Exit Code:

Returns 0 on success and non-zero on error.

setrep

Usage:?hdfs dfs -setrep [-R] [-w] <numReplicas> <path>

Changes the replication factor of a file. If?path?is a directory then the command recursively changes the replication factor of all files under the directory tree rooted at?path.

Options:

Example:

Exit Code:

Returns 0 on success and -1 on error.

stat

Usage:?hdfs dfs -stat URI [URI ...]

Returns the stat information on the path.

Example:

Exit Code: Returns 0 on success and -1 on error.

tail

Usage:?hdfs dfs -tail [-f] URI

Displays last kilobyte of the file to stdout.

Options:

Example:

Exit Code: Returns 0 on success and -1 on error.

test

Usage:?hdfs dfs -test -[ezd] URI

Options:

Example:

text

Usage:?hdfs dfs -text <src>

Takes a source file and outputs the file in text format. The allowed formats are zip and TextRecordInputStream.

touchz

Usage:?hdfs dfs -touchz URI [URI ...]

Create a file of zero length.

Example:

Exit Code: Returns 0 on success and -1 on error.

bin/hdfs dfs命令

原文:https://www.cnblogs.com/starzy/p/10530338.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!