How to copy a file from local file system to hdfs?

I am trying to copy 2 files to hdfs from but for some reason i done see my folder “amitgokh” created under /user folder

[amitgokh@gw03 ~]$ hadoop fs -ls /home/amitgokh/udproject/Performance_2018Q3.txt /home/amitgokh/
ls: /home/amitgokh/udproject/Performance_2018Q3.txt': No such file or directory ls:/home/amitgokh/’: No such file or directory
[amitgokh@gw03 ~]$

Please check with the command. You have given /home instead of /user. Check with the syntax once.

I am trying to copy files which are under /home/amitgokh/udproject to hdfs cluster /user/amitgokh

Command : hadoop fs -ls /home/amitgokh/udproject /user/amitgokh

  1. Copy the file from the local file system to HDFS.

    Syntax: hadoop fs -copyFromLocal </path/in/linux> </hdfs/path>

Example:

hadoop fs -copyFromLocal /home/amitogokh/udproject/Performance_2018Q3.txt /user/amitgokh

  1. To list the files in hdfs user home directory.

    syntax: hadoop fs -ls /user/

Example:

  hadoop fs -ls /user/amitgokh