HDFS command line is the most commonly used basic operation

Big data learning monk 2022-02-13 07:18:37 阅读数:65

hdfs command line commonly used

HDFS Command line official document operation http://hadoop.apache.org/docs/r1.0.4/cn/hdfs_shell.html

hdfs The most basic command line uses
HDFS The command line is the most commonly used basic operation

(1) view help

hdfs dfs -help

(2) View current catalog information
hdfs dfs -ls /

(3) Upload files
hdfs dfs -put / The local path /hdfs route

(4) Cut file
hdfs dfs -moveFromLocal a.txt /aa.txt

(5) Download files to local
hdfs dfs -get /hdfs route / The local path

(6) Merge downloads
hdfs dfs -getmerge /hdfs Path folder / Combined documents

(7) Create folder
hdfs dfs -mkdir /hello

(8) Create multi-level folders
hdfs dfs -mkdir -p /qwe/qqq/www

(9) Move hdfs file
hdfs dfs -mv /hdfs route /hdfs route

(10) Copy hdfs file
hdfs dfs -cp /hdfs route /hdfs route

(11) Delete hdfs file
hdfs dfs -rm /aa.txt

(12) Recursive deletion hdfs Multi level folder
hdfs dfs -rm -r /qwe
Can also be
hdfs dfs -rm -R /qwe

(13) see hdfs Documents in
hdfs dfs -cat / file hdfs dfs -tail -f / file

(14) See how many files are in the folder
hdfs dfs -count / Folder

(15) see hdfs The total space of
hdfs dfs -df /
Display units
hdfs dfs -df -h /

(16) Number of modified copies
hdfs dfs -setrep 1 /a.txt

(17) Give the root directory the highest permission
hdfs dfs -chmod 777 /

(18) Recursively give the highest permission to all files in the root directory
hdfs dfs -chmod -R 777 /

(19) see test The content of the document
hdfs dfs -text /test.txt

copyright:author[Big data learning monk],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/02/202202130718347722.html