[Turn]hadoop HDFs common commands

Source: Internet
Author: User
Tags hadoop fs

From:http://www.2cto.com/database/201303/198460.html

Hadoop HDFs Common Commands Hadoop common commands:Hadoop FSView all commands supported by Hadoop HDFs Hadoop fs–lslisting directory and file information Hadoop FS–LSRLoop lists directories, subdirectories, and file information Hadoop fs–put Test.txt/user/sunlightcsCopy the test.txt of the local file system to the/user/sunlightcs directory of the HDFs file system Hadoop fs–get/user/sunlightcs/test.txt.Copy the test.txt in HDFs to the local file system, as opposed to the-put command Hadoop fs–cat/user/sunlightcs/test.txtView the contents of Test.txt in the HDFs file system Hadoop fs–tail/user/sunlightcs/test.txtSee what's last 1KB Hadoop fs–rm/user/sunlightcs/test.txtDelete test.txt file from HDFs file system, RM command can also delete empty directory Hadoop Fs–rmr/user/sunlightcsDelete the/user/sunlightcs directory and all subdirectories Hadoop fs–copyfromlocal test.txt/user/sunlightcs/test.txtcopying files from the local file system to the HDFs file system, equivalent to the put command Hadoop fs–copytolocal/user/sunlightcs/test.txt test.txtcopy files from the HDFs file system to the local file system, equivalent to the GET command Hadoop Fs–chgrp [-R]/user/sunlightcsModify the group belonging to the/user/sunlightcs directory in the HDFS system, option-R executes recursively, as with the Linux command Hadoop Fs–chown [-R]/user/sunlightcsModify the/user/sunlightcs directory owner in the HDFS system, option-r recursive execution Hadoop Fs–chmod [-R] Mode/user/sunlightcsModify the/user/sunlightcs directory permissions in the HDFS system, mode can be 3 digits or +/-{rwx} for the corresponding permission, and option-R recursively executes Hadoop Fs–count [-Q] PATHView the path directory, number of subdirectories, number of files, file size, filename/directory name hadoop fs–cp src [src ...] DSTcopy files from src to DST, if more than one SRC is specified, DST must be a directory Hadoop fs–du PATHdisplays the size of each file or directory in the directory Hadoop fs–dus PATHsimilar to Du,path, the total size of the directory is displayed Hadoop Fs–expungeemptying the Recycle Bin, when the file is deleted, it first moves to the temp directory. trash/, files are permanently deleted when the delay time is exceeded hadoop fs–getmerge src [src ...] LOCALDST [ADDNL]gets all the files specified by SRC, merges them into a single file, and writes to LOCALDST in the local file system, option ADDNL adds a newline character at the end of each file Hadoop fs–touchz PATHcreate an empty file with a length of 0 Hadoop fs–test–[ezd] PATHThe following types of checks are performed on path:whether the-e path exists and returns 0 if path exists, otherwise 1- z file is empty, if length is 0, returns 0, otherwise returns 1- D is a directory, if path is a directory, returns 0, otherwise 1 Hadoop fs–text PATHDisplays the contents of the file, when the file is a text file, the same as cat, when the file is in compressed format (gzip and Hadoop binary sequence file format), it is decompressed first Hadoop fs–help lsto view the help document for a [LS] command

[Turn]hadoop HDFs common commands

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.