The Hadoop HDFS summary of Shell script command

https://www.cppentry.com/bencandy.php?fid=115&id=223457

First, the basic concept of the HDFS Shell

1. Call File System (FS) Shell command should use the bin / hadoop fs command or bin hdfs dfs form / command. [For simplicity, generally added to the path in the bin directory]
2. All FS shell URI path as a command parameter.
  URI format scheme: // authority / path. HDFS The scheme is hdfs, the local file system, scheme is file. Wherein the scheme and authority are optional, and if not added unspecified, the default configuration specified in the scheme. For example: hdfs: // namenode: namenodePort / parent / child, can be expressed as / parent / child (assuming the configuration file is namenode: namenodePort)
Behavior 3. Most FS Shell commands and corresponding command is similar LINUX Shell.

Two, HDFS's Shell command

 

-help [cmd] // display help information about the command
-ls (r) <path> // display all the files in the current directory
-du (s) <path> // show all files in the directory size
-count [-q] <path> // display the number of files in the directory
-mv <src> <dst> // move multiple files to the target directory
-cp <src> <dst> // copy multiple files to the target directory
-rm (r) // delete the file (folder)
Copy -put <localsrc> <dst> // local file to hdfs
-copyFromLocal //同put
-moveFromLocal // move from local files to hdfs
-get [-ignoreCrc] <src> <localdst> // copy the file to the local crc check can be ignored
-getmerge <src> <localdst> // sort all files in the source directory merge into one file
-cat <src> // display the contents of the file in the terminal
-text <src> // display the contents of the file in the terminal
-copyToLocal [-ignoreCrc] <src> <localdst> // local copy
-moveToLocal <src> <localdst>
-mkdir <path> // Create a folder
-touchz <path> // create an empty file

 

Three, HDFS's Shell command (practice)

#hadoop fs -ls / View HDFS root directory
#hadoop fs -mkdir / test creates a directory in the root directory of the Test
#hadoop FS -put ./test.txt / or the Test #hadoop fs -copyFromLocal /test.txt / test upload files
#hadoop fs -get /test/test.txt or #hadoop fs -getToLocal /test/test.txt download files
#hadoop fs -rm /test1/test.txt delete files
#hadoop fs -rmr / test1 delete a folder
#hadoop fs -mv /test/test.txt / test1 move files

Guess you like

Origin www.cnblogs.com/ceshi2016/p/12118696.html