Hadoop dfs -ls command?

0 votes

I have Hadoop installed in this location:

/usr/local/hadoop$

Here I am listing out the files present in my dfs directory. So for this, I used the command: user1@ubuntu:/usr/local/hadoop$ bin/hadoop dfs -ls

This gave me the correct result.

But after that, I tried the same command in a different manner

user1@ubuntu:/usr/local/hadoop$ hadoop dfs -ls

I again got the same result.

Could anyone explain me that why I'm getting the same result despite of executing the commands from different folders. I hope you understand my question, I just want to know the difference between the two commands:

1. user1@ubuntu:/usr/local/hadoop$ bin/hadoop dfs -ls

2. user1@ubuntu:/usr/local/hadoop$ hadoop dfs -ls

Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 9,670 points
676 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

In your case there is no difference between the two commands because it looks like that you set /usr/local/hadoop/bin as HADOOP_HOME path in the .bashrc file.

Since in unix we can execute an executable file in two ways, either by giving the absolute/relative path or commands in system's executable path. 

So, when you execute - "bin/hadoop dfs -ls" , it will take you inside the directory /usr/local/hadoop. If you remove the HADOOP_HOME path from the .bashrc file, then you will not get the same result.

answered Mar 16, 2018 by kurt_cobain
• 9,240 points

Related Questions In Big Data Hadoop

0 votes
1 answer

start-dfs.sh command is not starting Hadoop JobTracker & TaskTracker

start-dfs.sh script, only starts the HDFS daemons. ...READ MORE

answered Apr 15, 2018 in Big Data Hadoop by Shubham
• 12,890 points
488 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
42 views
+1 vote
1 answer
0 votes
1 answer

Hadoop: TaskTracker and JobTracker don't start with start-dfs.sh

You must run the start-dfs..sh too. So when ...READ MORE

answered Apr 3, 2018 in Big Data Hadoop by kurt_cobain
• 9,240 points
104 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
• 9,670 points
1,879 views
0 votes
10 answers

hadoop fs -put command?

copy command can be used to copy files ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Sujay
9,391 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
• 9,670 points
1,433 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
8,158 views
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,240 points
2,114 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.