Command line use of hdfs

Syntax: hdfs dfs parameters

hdfs dfs -ls / View files or folders under the root path

hdfs dfs -mkdir [-p] /xx/xxx Create folders on hdfs [recursively]

hdfs dfs -moveFromLocal sourceDir (the path of the file or folder on the local disk) destDir (the path of hdfs) [move from local to hdfs]

hdfs dfs -mv hdfsSourceDir hdfsDestDir move from one location to another in hdfs

hdfs dfs -put localDir hdfsDir puts the files or folders of the local file system on hdfs

     hdfs dfs -put [wife/ /] The former is the file to be uploaded, and the latter is the uploaded hdfs directory  

hdfs dfs -appendToFile a.txt b.txt /hello.txt merge multiple small files into one big file

hdfs dfs -cat hdfsDir View the contents of the hdfs file

hdfs dfs -cp hdfsSourceDir hdfsDestDir copy files or folders

hdfs dfs -rm [-r] (recursively) delete files or folders

Two commands for hdfs permission management:

hdfs dfs -chmod -R 777 /xxx change file access permissions

     -R: used to modify the permissions of all sub-files under the folder, all modified to 777

hdfs dfs -chown -R hadoop:hadoop /xxx change user and user group

Guess you like

Origin blog.csdn.net/qq_30398499/article/details/91346424