hadoop fs -put command?

+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 ?
Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,280 points
18,201 views

11 answers to this question.

+1 vote

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

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

Alternatively you can also use the commmand "hdfs dfs -copyFromLocal /root/Hadoop/sample.txt /"your_hdfs_dir_path"

answered Mar 16, 2018 by nitinrawat895
• 10,760 points
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 by pallavi
1 flag
Irrelevant!!

Related Questions In Big Data Hadoop

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
• 68,160 points
1,840 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,610 points
92 views
+1 vote
1 answer
0 votes
1 answer

hadoop: command not found

The reason you are getting hadoop as ...READ MORE

answered Mar 27, 2018 in Big Data Hadoop by kurt_cobain
• 9,280 points
3,225 views
0 votes
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
• 10,760 points
3,551 views
0 votes
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,280 points
1,319 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
• 10,760 points
2,171 views
+1 vote
2 answers

What does hadoop fs -du command gives as output?

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

answered Jul 23 in Big Data Hadoop by Lokesh Singh
1,183 views
+2 votes
10 answers

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

Yes, there's a difference between hadoop fs and ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Kunal
11,602 views