Create Directory in HDFS

Takes the path URI’s like an argument and creates a directory or multiple directories. Remember that you must create a home directory in HDFS with your system’s username. For example, you are logged in as hduser on your system, So first create /user/hduser else you will get this error, Now create directory structure inside it

Copy Files to HDFS

After creating directory structure, Now put some files to HDFS from your local file system. For example you have test1.txt in current directory and /tmp/test2.xml on your local file system.

List Files from HDFS

Use the following example commands to list the content of the directory in HDFS. Use -R to list files recursively inside directories. For example:

Download Files from HDFS

At this point, you have learned how to copy and list files to HDFS. Now use following example commands to how to download/Copy files from HDFS to the local file system. here /tmp is on system’s local file system.

Copy Files between HDFS Directories

You can easily copy files between HDFS file system using distcp option.