Complete the code to list files in the HDFS root directory.
hdfs dfs -ls [1]The root directory in HDFS is represented by '/'. Using hdfs dfs -ls / lists files and directories at the root.
Complete the code to copy a local file named 'data.txt' to the HDFS directory '/user/hadoop/'.
hdfs dfs -[1] data.txt /user/hadoop/The put command uploads a local file to HDFS. So hdfs dfs -put data.txt /user/hadoop/ copies the file to HDFS.
Fix the error in the command to remove the directory '/user/hadoop/temp' and all its contents.
hdfs dfs -rm [1] /user/hadoop/tempThe -rm command needs the -R option (recursive) to delete directories with contents. So hdfs dfs -rm -R /user/hadoop/temp works.
Fill both blanks to display the first 10 lines of the HDFS file '/user/hadoop/log.txt'.
hdfs dfs -[1] /user/hadoop/log.txt | head -[2]
The cat command outputs the file content. Piping it to head -10 shows the first 10 lines.
Fill all three blanks to create a directory '/user/hadoop/newdir' and then move the file 'data.csv' into it.
hdfs dfs -[1] /user/hadoop/newdir hdfs dfs -[2] [3] /user/hadoop/newdir/
First, create the directory with mkdir. Then move the file using mv. The source file is 'data.csv'.