0
0
Hadoopdata~10 mins

HDFS command line interface in Hadoop - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to list files in the HDFS root directory.

Hadoop
hdfs dfs -ls [1]
Drag options to blanks, or click blank then click option'
A/tmp
B/data
C/
D/user
Attempts:
3 left
💡 Hint
Common Mistakes
Using a subdirectory like /user instead of root.
Forgetting the leading slash.
2fill in blank
medium

Complete the code to copy a local file named 'data.txt' to the HDFS directory '/user/hadoop/'.

Hadoop
hdfs dfs -[1] data.txt /user/hadoop/
Drag options to blanks, or click blank then click option'
Acat
Bput
Cget
Dls
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'get' instead of 'put'.
Using 'cat' which only displays file content.
3fill in blank
hard

Fix the error in the command to remove the directory '/user/hadoop/temp' and all its contents.

Hadoop
hdfs dfs -rm [1] /user/hadoop/temp
Drag options to blanks, or click blank then click option'
A-r
B-f
C-d
D-R
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-r' (lowercase) instead of '-R'.
Forgetting the recursive flag and getting an error.
4fill in blank
hard

Fill both blanks to display the first 10 lines of the HDFS file '/user/hadoop/log.txt'.

Hadoop
hdfs dfs -[1] /user/hadoop/log.txt | head -[2]
Drag options to blanks, or click blank then click option'
Acat
Btail
C10
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'tail' instead of 'cat' which shows last lines.
Using 'head -5' which shows only 5 lines.
5fill in blank
hard

Fill all three blanks to create a directory '/user/hadoop/newdir' and then move the file 'data.csv' into it.

Hadoop
hdfs dfs -[1] /user/hadoop/newdir
hdfs dfs -[2] [3] /user/hadoop/newdir/
Drag options to blanks, or click blank then click option'
Amkdir
Bmv
Cdata.csv
Dcp
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'cp' instead of 'mv' which copies instead of moving.
Forgetting to create the directory before moving the file.