Hadoop dfs -ls command?

–1 vote

I have Hadoop installed in this location:


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
• 10,920 points

1 answer to this question.

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,310 points
スーパーコピーブランド専門ショップ時計 バッグ 財布N級品販売通販
◆2019年は最も新型に人気があって、新しい素材の商品到着! 人気ブランド品大注目
海外スーパーコピーのスーパーコピー バッグ、アクセサリー
正規品と同等品質のコピー品 https://www.yutee007.com/protype/list-223.html

Related Questions In Big Data Hadoop

0 votes
2 answers

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

On which version of hadoop do you ...READ MORE

answered Jul 24, 2019 in Big Data Hadoop by Lokesh Singh
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
+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,310 points
+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
• 10,920 points
+1 vote
11 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyF ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
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,920 points
+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
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,310 points