Hadoop some common commands

hadoop fs -ls -R

After this command + hdfs path, you can view all files and directories under the hdfs path

hadoop fs -ls -R /user/hive/warehouse/big_recruitment.db/dim_area_full

 Generally, we only need the eighth result, which is the name of the file or the literary talent of the directory, which can be obtained in this way

hadoop fs -ls -R /user/hive/warehouse/big_recruitment.db/dim_area_full | awk {'print $8}'

 hadoop fs -test -z

After this command + the path of the hdfs file, you can check whether there is data in the hdfs file, return 1 means there is data, return 0 means there is no data, note: the return value needs to be obtained with $?

hadoop fs -test -z /user/hive/warehouse/big_recruitment.db/dim_area_full/provinces_template.txt

hadoop fs -test -e

After this command + hdfs path, determine whether the path or file exists, return 0 if it exists, and return 1 if it does not exist

hadoop fs -test -e /origin_data/big_recruitment/data/2022-05-24

 

Guess you like

Origin blog.csdn.net/m0_55868614/article/details/126446241