hdfs dfs Use command , Path use /project/test/ replace

<> for example

Query the sample data of the first few lines :
hdfs dfs -cat /project/test/test.txt | head -17

After query 5 Row data :
hdfs dfs -cat /project/test/test.txt | tail -5

Returns a sample of a specified number of rows at random :
hdfs dfs -cat /project/test/test.txt | shuf -n 5

View the number of lines of text :
hdfs dfs -cat /project/test/test.txt | wc -l

Query the contents of the file after the fifth line :
hdfs dfs -cat /project/test/test.txt | tail -n +5

Query filter field num:
hdfs dfs -cat /project/test/test.txt | grep num

View file size :
hdfs dfs -du /project/test/test.txt
hdfs dfs -du /project/test/*

Displays the number of files under the folder :
hdfs dfs -count /project/test/

Create directory dir1 and dir2:
hdfs dfs -mkdir -p /project/test/dir1 /project/test/dir2

Show folder test Directory under :
hdfs dfs -ls /project/test/
Recursive display test Directory under :
hdfs dfs -ls -R /project/test/ or hdfs dfs -lsr /project/test/

Upload local files to hdfs Target path :
hdfs dfs -put /home/bb/test1.txt /project/test/

Copy files from destination path to local :
hdfs dfs -get /project/test/test1 /home/bb/

Copy the file or directory to the destination path :
hdfs dfs -cp from path Target path

Delete file or directory :
hdfs dfs -rm route
Delete the folder and its contents :
hdfs dfs -rm -r route
Skip trash can deletion :
hdfs dfs -rm -r -skipTrash route

Display as text to standard output :
hdfs dfs -text /project/test/

Displays the last of the file 1KB To standard output :
hdfs dfs -tail -f /project/test/t.txt

©2019-2020 Toolsou All rights reserved,
【Java8 New features 1】Lambda Expression summary What is a process , Concept of process ?hdfs dfs Common basic commands java When creating objects, you must _Java Basic test questions Generation of random numbers + Figure guessing game When will we enter the old generation ?HDFS Common commands ( summary ) It is never recommended to spend a lot of time studying for employment pythonmacOS Big Sur The installation could not be completed Big Sur Why can't I install it ?Python pyttsx3| Text reading ( Various languages )