0
0
Hadoopdata~5 mins

HDFS command line interface in Hadoop - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the HDFS command line interface?
The HDFS command line interface allows users to interact with the Hadoop Distributed File System to manage files and directories, such as creating, deleting, and viewing files.
Click to reveal answer
beginner
Which command lists files and directories in HDFS?
The command hdfs dfs -ls lists files and directories in the current or specified HDFS directory.
Click to reveal answer
beginner
How do you copy a file from the local file system to HDFS?
Use the command hdfs dfs -put <local_path> <hdfs_path> to copy a file from your local machine to HDFS.
Click to reveal answer
intermediate
What command removes a file or directory in HDFS?
The command hdfs dfs -rm <path> removes a file, and hdfs dfs -rm -r <path> removes a directory recursively in HDFS.
Click to reveal answer
beginner
How can you display the contents of a file stored in HDFS?
Use hdfs dfs -cat <hdfs_file_path> to print the contents of a file stored in HDFS to the terminal.
Click to reveal answer
Which command shows the files in the root directory of HDFS?
Ahdfs dfs -cat /
Bhdfs dfs -put /
Chdfs dfs -ls /
Dhdfs dfs -rm /
How do you copy a file named 'data.txt' from local to HDFS directory '/user/hadoop/'?
Ahdfs dfs -get data.txt /user/hadoop/
Bhdfs dfs -cat data.txt /user/hadoop/
Chdfs dfs -rm data.txt /user/hadoop/
Dhdfs dfs -put data.txt /user/hadoop/
Which command removes a directory and all its contents in HDFS?
Ahdfs dfs -rm /dir
Bhdfs dfs -rm -r /dir
Chdfs dfs -ls /dir
Dhdfs dfs -cat /dir
What does the command hdfs dfs -cat /file.txt do?
ADisplays the file content
BLists the file details
CDeletes the file
DCopies the file to local
Which command copies a file from HDFS to the local file system?
Ahdfs dfs -get
Bhdfs dfs -put
Chdfs dfs -rm
Dhdfs dfs -ls
Explain how to list, add, and remove files in HDFS using the command line interface.
Think about commands for viewing, uploading, and deleting files.
You got /3 concepts.
    Describe the difference between the commands hdfs dfs -put and hdfs dfs -get.
    Consider the direction of file transfer.
    You got /2 concepts.