HDFS Commands


localhost:50070/dfs
1.mkdir path

 

2. -ls path

 

3. -lsr path

 

4. -cp path  

 

5. -rm -r path

 

6. -chmod path

 

7. -put localSrc dest and -copyFromLocal localSrc dest 

 

8.  -moveFromLocal localSrc destination

 

9. -cat path/filename

 

10. -du path

 

11.  -count path 

 

12. -touchz path

 

12. -get and -copyToLocal

 


1. -mkdir path

Create a  directory in HDFS specified by the path.



2.  -ls path
Lists the contents of the directory specified by the path. Showing the names, permissions, owner, size and modification date for each entry.


3. -lsr path
It behaves liks -ls. but recursively displays entries in all subdirectories of path.



4. -cp path
This command copies the content from one directory to another directory in HDFS




5. -rm -r path

Remove the file or directory, specified by the path.


6. -chmod path
 This command changes the permission of directory and file.
In this example we changed the permission of prabhat directory to 777.  



7. -put localSrc dest and -copyFromLocal localSrc dest 

Copy the file from the local file system to the HDFS system. 
     -put command allows reading from stdin(Standard Input).
     -copyFromLocal command allows only local references as a source.



8. -moveFromLocal localSrc destination
Copies the file or directory from the local file system identified by localSrc to dest within HDFS, then delete the file from local directory.


9. -cat path/filename
Displays the content of filename.


10. -du path
Show disk usage in bytes, for file which match the path.


11. -count path
This command will count the directories specified by the path.



12. -touchz path
This command is used to create a file of length zero(0-bytes). This command is similar to the UNIX 'touch' command.


13. -get and -copyToLocal
These command copies from HDFS to the local file system. 


Using -copyToLocal command

Using -get Command

Popular Posts