To copy a file from HDFS (Hadoop Distributed File System) to the local file system, you can use any of the following methods:
1. hadoop fs -get:
hadoop fs -get /user/hadoop/transferfile.txt /home/user/transferfile.txt
Explanation:
The first argument, /user/hadoop/transferfile.txt, is the path of the file in HDFS.
The second argument, /home/user/transferfile.txt, is the path where you want to save the file on your local system.
2.hadoop fs -copyToLocal:
hadoop fs -copyToLocal /user/hadoop/transferfile.txt /home/user/transferfile.txt
3.hadoop fs -cat with Redirection
hadoop fs -cat /user/hadoop/transferfile.txt /home/user/transferfile.txt