1.

List Hadoop HDFS Commands.

Answer»

A)version:  hadoop version

interviewbit:~$ hadoop versionHadoop 3.1.2Source code repository HTTPS://github.com/apache/hadoop.git -rCompiled by sunlig on 2019-01-29T01:39Zinterviewbit:~$

B) mkdir: Used to create a new directory.

interviewbit:~$ hadoop FD -mkdir/interviewbit interviewbit:~$

C) cat: We are using the cat command to display the content of the file present in the directory of HDFS.
hadoop fs –cat /path_to_file_in_hdfs

interviewbit:~$ hadoop fs -cat/interviewbit/sample Hello from InterviewBit…File in HDFS …interviewbit:~$

D)mv : The HDFS mv command moves the files or directories from the SOURCE to a destination WITHIN HDFS.
hadoop fs -mv <src> <dest>

interviewbit:~$ hadoop fs -ls/Found 2 Itemsdrwxv -xv -x - interviewbit supergroup 0 2020-01-29:11:11/ Intr1drwxv -xv -x - interviewbit supergroup 0 2020-01-29:11:11/ Interviewbitinterviewbit:~$ hadoop fs -mv/ Intr1/ Interviewbitinterviewbit:~$ hadoop fs -ls/Found 1 Itemdrwxv -xv -x - interviewbit supergroup 0 2020-01-29:11:11/ Interviewbit

E) copyToLocal: This command copies the file from the file present in the newDataFlair directory of HDFS to the local file system.
hadoop fs -copyToLocal <hdfs source> <localdst>

interviewbit:~$ hadoop fs -copyFromLocal -/test1/interviewbit/CopyTestinterviewbit:~$ 

F) GET: Copies the file from the Hadoop File System to the Local File System.
hadoop fs -get<src> <localdest>

interviewbit:~$ hadoop fs - get/testFile ~/copyFromHadoopinterviewbit:~$


Discussion

No Comment Found