hadoop fs -put command

+2 votes
I had a file in my local system and want to copy it to HDFS. can i use the copy command or Put command? How ?
Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,350 points
108,850 views
you can use either command as both allow copying from local system.

11 answers to this question.

+2 votes
Best answer

Hi,

You can create one directory in HDFS using the command “hdfs dfs -mkdir <path>” and, then use the given below command to copy data from the local file to HDFS: 

$ hdfs dfs -put /root/Hadoop/sample.txt /"your_hdfs_dir_path" 

Alternatively, you can also use the below command.

$ hdfs dfs -copyFromLocal /root/Hadoop/sample.txt /"your_hdfs_dir_path
For details, You can even check out Hadoop Ecosystem tools with the Online big data courses.
answered Mar 16, 2018 by nitinrawat895
• 11,380 points

selected Dec 15, 2020 by MD
It worked, thanks
0 votes

put and copyFromLocal are very similar with a thin lining in between with copyFromLocal having source restricted to a local file reference.

answered Nov 27, 2018 by Kailash
0 votes
Adding to @Kailash's answer, put can take file from any file system, be it hdfs or local.
answered Nov 27, 2018 by Kangana
0 votes
I think in your case you should be using put. Refer other answers to understand the difference between put and copyFromlocal.
answered Nov 27, 2018 by Neha
0 votes

You can use put command:

hadoop fs -put localpath
answered Dec 7, 2018 by Jacqueline
0 votes
hadoop fs -put <LOCAL_source> ... <HDFS_destination>
answered Dec 7, 2018 by John
0 votes
You can use either command. Both the commands will get your work done.
answered Dec 7, 2018 by Namitha
+2 votes

put syntax:

put <localSrc> <dest>

copy syntax:

copyFromLocal <localSrc> <dest>
answered Dec 7, 2018 by Aditya
given for any eample

copyFromLocal

HDFS Command to copy the file from a Local file system to HDFS.

Usage: hdfs dfs -copyFromLocal <localsrc> <hdfs destination> 

Command: hdfs dfs –copyFromLocal /home/edureka/test /new_edureka

Copy File from Local to HDFS - HDFS Commands - Edureka

put

HDFS Command to copy single source or multiple sources from local file system to the destination file system.

Usage: hdfs dfs -put <localsrc> <destination>

Command: hdfs dfs –put /home/edureka/test /user

Put Command - HDFS Commands - Edureka

+1 vote

Both put and copy allow you to copy the file from local system to hdfs

answered Dec 7, 2018 by Preetham
+1 vote

copy command can be used to copy files only from local system but put  can be used to copy file from any file system. 

So, you can use either command as both allow copying from local system. 

answered Dec 7, 2018 by Sujay
+1 vote

I had a file in my local system and want to copy it to HDFS. can i use the copy command or Put command? How ?

Procedure

1

List the available clusters with the cluster list command.

2

Connect to the Hadoop cluster whose files or directories you want to copy to or from your local filesystem.

cluster target --name cluster_name

3

Run the command cfg fs --namenode namenode_address.

You must run this command before using fs put or fs get to identify the namenode of the HDFS.

4

You can copy (upload) a file from the local filesystem to a specific HDFS using the fs put command.

fs put --from source_path_and_file --to dest_path_and_file

The specified file or directory is copied from your local filesystem to the HDFS.

5

You can copy (download) a file from the a specific HDFS to your local filesystem using the fs get command.

fs get --from source_path_and_file --to dest_path_and_file

The specified file or directory is copied from the HDFS to your local filesystem.

Regards: Hadoop Admin Training in Pune

answered Nov 25, 2019 by pallavi
1 flag
Irrelevant!!

Related Questions In Big Data Hadoop

+1 vote
2 answers

What does hadoop fs -du command gives as output?

du command is used for to see ...READ MORE

answered Jul 24, 2019 in Big Data Hadoop by Lokesh Singh
5,865 views
0 votes
2 answers

Hadoop fs -stat command

hadoop fs -stat is as hadoop command used ...READ MORE

answered Oct 25, 2018 in Big Data Hadoop by Omkar
• 69,220 points
11,308 views
0 votes
1 answer

The file exists before processing with hadoop command

Took session and it got resolved. READ MORE

answered Dec 18, 2017 in Big Data Hadoop by Sudhir
• 1,570 points
1,043 views
+2 votes
10 answers

Is there any difference between “hdfs dfs” and “hadoop fs” shell commands?

hadoop fs <args> fs is used for generic ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by anonymous
34,045 views
+1 vote
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 11,380 points
11,032 views
–1 vote
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,350 points
4,615 views
0 votes
1 answer
+1 vote
1 answer

Where to set hadoop.tmp.dir? core-site.xml or hdfs-site.xml?

hadoop.tmp.dir (A base for other temporary directories) is ...READ MORE

answered Mar 26, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
9,006 views
0 votes
1 answer

“no such file or directory" in case of hadoop fs -ls

The behaviour that you are seeing is ...READ MORE

answered May 9, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points

edited May 9, 2018 by nitinrawat895 8,227 views
0 votes
1 answer

How can I download only hdfs and not hadoop?

No, you cannot download HDFS alone because ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
1,543 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP