Shell operations in HDFs

Source: Internet
Author: User
Tags hadoop fs

HDFs File System:

HDFs is a distributed file system to access data, then the operation of HDFs is the basic operation of the file system, such as file creation, modification, deletion, modify permissions, folder creation, deletion, renaming and so on. The operation of the HDFs command is similar to the Llinux Shell's operation of the file, such as LS, mkdir, RM, and so on.

When we do the following, make sure Hadoop is working correctly, and use the JPS command to ensure that each Hadoop process is seen.
We execute the command Hadoop FS, shown in 4-1

The commands here are not very full, and the commands in the following table are all the commands supported by Hdfs-shell:

Option name Use formatting Meaning
-ls -ls< path > View the current directory structure for the specified directory
-lsr -lsr< path > Recursively view the directory structure of a specified path
-du -du< path > File size under Statistics directory
-dus -dus< path > Size of file (clip) in summary statistics directory
-count -count[-q]< path > Number of Statistics folders
-mv -mv< Source Path >< Destination path > Move
-cp -cp< Source Path >< Destination path > Copy
+r+ -rm[-skiptrash]< path > Delete a file or a blank folder
-rmr -rmr[-skiptrash]< path > Recursive deletion
-put -put[files > Uploading files
-copyfromlocal -copyfromlocal< files > Copy from local
-movefromlocal -movefromlocal< files > Move from local
-getmerge -getmerge< Source path ><linux path > Merge to File
-cat -cat View File Contents
-text -text View File Contents
-copytolocal -copytolocal[-ignorecrc][-crc][hdfs Source path][linux Destination Path] Copy from local
-movetolocal -movetolocal [-CRC] Move from local
-mkdir -mkdir Create a blank folder
-setrep -setrep[-r][-w]< number of copies >< paths > Modifying a copy File
-touchz -touchz< file Paths > Create a blank file
-stat -stat[format]< path > displaying file statistics
-tail -tail[-f]< File > View File trailer Information
-chmod -chmod[-r]< permission mode >[path] Modify Permissions
-chown -chown[-r][(genus][:[Group]) path Modify Owner
-chgrp -chgrp[-r] Genus group name path Modify Genus Group
-help -help [Command Options] Help

-ls Show current directory structure

View the current directory structure for the specified path, followed by the HDFs path,

The path in is the root directory of HDFs, and the file directory displayed is very similar to the content format displayed by the Linux command-ls-l, which parses the content format of each line:

    • The first letter indicates a folder or a file, "D" means a folder, "-" represents a file;
    • The following nine-bit characters represent permissions;
    • The following number or "-" indicates the number of replicas. If it is a file, the number of copies is used, and the folder has no copy;
    • The root of the following indicates the owner;
    • The supergroup after Root represents a group;
    • The following 0/6176/37645 indicates the size of the file, in bytes;
    • The later time represents the modification time, the time represents the month and day hour;
    • The last item represents the path to the file;

Note : If the command option is not followed by a path, then the/user/< current user > directory is accessed, for example, we are using the root user login, so the/user/root/directory is accessed, and if there is no/user/root/, An error will be prompted that the file does not exist.

Shell operations in HDFs

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.