HDFS Part -3


In this post, we are going to learn about some of the basic HDFS commands. We can use most of the unix commands in the Hadoop also, but we need to use prefix hadoop fs  of hdfs dfs before shooting the commands for HDFS.

Consider an example, we wish to list all the files on a path, we can use ls/ll/ls -ltr commands in Unix for this purpose, but in Hadoop, we can use only ls command with the prefix hadoop fs. The hdfs command will look like hadoop fs -ls. We need to mention '-' before all hadoop commands.

Syntax:- hadoop fs <arg>

Below are few of HDFS commands you can try with their significance:
    
Arg
Usage
-ls
List all the directories available at the path.
-put
Copy file from Local to HDFS.
-mkdir
Create Folder.
-put –f
Copy files from Local to HDFS and overwrite previous file.
-get
Copy files from HDFS to Local.
-rm –r 
Delete file from HDFS and move file to Trash folder.
-rm –r <file> -skipTrash
Delete file from HDFS and do not move file to Trash folder.
-cat
Read the contents of the file.

These are the basic HDFS commands, on top of this there are a few other HDFS commands like distcp, which used to copy the data from one cluster to another. We will continue about distcp in our next posts.

You can try to implement these commands to get better understanding. In Hadoop there are a few alternate commands for the above mentioned commands. We can use any of the command and there functioning is same. such as:-

For 
        put -- copyFromLocal command
        get --copyToLocal comamnd

We will continue to dig more on Hadoop in next post. Kindly share your feedback on the post and the areas to be improved or to focus more.






Comments

Popular posts from this blog

DistCp2

DistCP

Yarn Apache Hadoop

Big Data Intro

Hadoop Learning

HDFS Part -2

Big Data Intro Part-2

HDFS Part -1