What is difference between put and copyfromlocal



Greeting everyone you will be looking around what are the difference between put and copyfromlocal. hadoopquiz present here a clear difference

Many of us usually get confuse while specifying difference between put and copyfromlocal.
Below table clearly specifies about this difference hope this will be usefull for you.
more differences related to hadoop ecosystem can be find @  Difference Zone


       put
           copyFromLocal
Usage
Usage: hdfs dfs -put < localsrc > … < dst >
hadoop fs -copyFromLocal<localsrc> URI
Functionality 1
Put ; Copy single src, or multiple srcs from local file system to the destinationfilesystem
copyFromLocal is similar to put command, except that the source is restricted to a local file reference.
Functionality 2
copy data from local system to HDFS
copy data from local system to HDFS
File Copying Specification
Single file copy: hadoop fs -put localfile/user/hadoop/hdfile

Multiple file copy : hadoopfs -put localfile1 localfile2 /user/hadoop/hddir

copyFromLocal seems to copy a single one file path
Stdin Support
support reading from stdin
does not support reading from stdin
  
Source Code for the same from Hadoop trunk
 
class CopyCommands {  
  public static void registerCommands(CommandFactory factory) {
    factory.addClass(Merge.class"-getmerge");
    factory.addClass(Cp.class"-cp");
    factory.addClass(CopyFromLocal.class"-copyFromLocal");
    factory.addClass(CopyToLocal.class"-copyToLocal");
    factory.addClass(Get.class"-get");
    factory.addClass(Put.class"-put");
  }
  public static class Put extends CommandWithDestination {
    public static final String NAME = "put";
    public static final String USAGE = "<localsrc> ... <dst>";
    public static final String DESCRIPTION =
      "Copy files from the local file system\n" +
      "into fs.";
    ...
  }
  public static class CopyFromLocal extends Put {
    public static final String NAME = "copyFromLocal";
    public static final String USAGE = Put.USAGE;
    public static final String DESCRIPTION = "Identical to the -put command.";
  }
}
a good reply related to difference between put and copyfromlocal is mentioned over stackoverflow.

Let's make an example: If your HDFS contains the path: /tmp/dir/abc.txt 
And if your local disk also contains this path then the hdfs API won't know which one you mean, unless you specify a scheme like file:// or hdfs://. 
Maybe it picks the path you did not want to copy.
Therefore you have -copyFromLocal which is preventing you from accidentally copying the wrong file, by limiting the parameter you give to the local filesystem.
Put is for more advanced users who know which scheme to put in front.

It is always a bit confusing to new Hadoop users which filesystem they are currently in and where their files actually are.

few more differences you can check below
Hadoop Difference Zone


Sr No
Difference Index
Link
1
What is difference between Operational vs. Analytical Systems
2
What is difference between RDBMS vs Hive
3
What is difference between RDBMS vs Hive vs Impala










if you want to add few many things please do comment in comment section.