Shell operations of HDFS

Source: Internet
Author: User
Tags hadoop fs

Since HDFS is a distributed file system for data access, operations on HDFS are basic operations on the file system, such as file creation, modification, deletion, and modification permissions, folder creation, deletion, and renaming. Pair

HDFS operation commands are similar to Linux Shell operations on files, but in HDFS, hadoop FS is the main command, and other commands such as LS, MV, and CP are used as the option of this command.

The following table lists some common HDFS Shell Command Options.

Option name

Format

Description

-Ls

-Ls <path>

View the current directory structure of the specified path

-LSR

-LSR <path>

Recursively view the directory structure of a specified path

-Du

-Du <path>

Measure the file size in the directory.

-DUS

-DUS <path>

Summarize the file (folder) size in the statistics directory

-Count

-Count [-q] <path>

Count the number of files (CLIPS)

-MV

-MV <Source Path> <Destination path>

Mobile

-CP

-CP <Source Path> <Destination path>

Copy

-Rm

-RM [-skiptrash] <path>

Delete files/empty folders

-RMR

-RMR [-skiptrash] <path>

-RMR [-skiptrash] <path>

-Put

-Put <files on multiple Linux instances> <HDFS path>

Upload files

-Copyfromlocal

-Copyfromlocal <files on multiple Linux instances>

<HDFS path>

Copy from local

-Movefromlocal

-Movefromlocal <files on multiple Linux instances>

<HDFS path>

Move from local

-Getmerge

-Getmerge <Source Path> <Linux path>

Merge to local

-Cat

-Cat <HDFS path>

View File Content

-Text

-Text <HDFS path>

View File Content

-Copytolocal

-Copytolocal [-ignorecrc] [-CRC] [HDFS Source Path

Path] [Linux Destination path]

Copy from local

-Movetolocal

-Movetolocal [-CRC] <HDFS Source Path> <Linux

Target path>

Move from local

-Mkdir

-Mkdir <HDFS path>

Create a blank folder

-Setrep

Setrep [-R] [-W] <Number of replicas> <path>

Modify the number of copies

-Touchz

-Touchz <file path>

Create a blank File

-Stat

-Stat [format] <path>

Display file statistics

-Tail

-Tail [-F] <File>

View File tail Information

-Chmod

-Chmod [-R] <permission mode> [path]

Modify permissions

-Chown

-Chown [-R] [owner] [: [group] path

Modify owner

-Chgrp

-Chgrp [-R] group name path

Modify Group

-Help

-Help [Command Options]

Help

Note: For paths in the preceding table, including paths in HDFS and those in Linux. The "Linux path" or "HDFS path" will be pointed out when ambiguity is easily caused ". If not explicitly stated, it means HDFS path

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.