1. Creating a directory in hdfs
$ hdfs dfs -mkdir <paths>
2. List the directories in hdfs
$ hdfs dfs -ls <args>
3. Permissions
4. Putting a file in to hdfs file system
$ hdfs dfs -put <local-src> ... <HDFS_dest_path>
5. Space utilization in hdfs directory
$ hdfs dfs -du URI
6. Downloading files from hdfs to local file system
$ hdfs dfs -get <hdfs_src> <localdst>
7. Merging two files
We can merge two files in hdfs file system into a single
file to the local file system as below
$ hdfs dfs -getmerge <src1> <src2>
<localdst> [addnl]
8. Copying files or directories recursively
$ hdfs dfs -cp <src-url> <dest-url>
9. Help command
Use help command to access hadoop command manual
10. Seeing the contents of a file
$ hdfs dfs -cat <path[filename]>
11. Copying a file from source to destination in hdfs file
system
$ hdfs dfs -cp <source> <dest>
12. Copy a file using copyFromLocal and copyToLocal
copyFromLocal
$ hdfs dfs -copyFromLocal <localsrc> URI
CopyToLocal
$ hdfs dfs -copyToLocal [-ignorecrc] [-crc] URI
<localdst>
13. Move file from source to destination in hdfs file system
$ hdfs dfs -mv <src> <dest>
14. Remove a file or directory from hdfs file system
$ hdfs dfs -rm <arg>
15. Remove files recursively
16. To display last few lines of a file
$ hdfs dfs -tail <path[filename]>
17. Hadoop version
18. To check amount of space used by hdfs file system
19. To count the number of files and directories in hdfs