Issue in hdfs dfs command

0 votes

I am not able to use pwd or cd command in hdfs dfs. Is there any specific way to move to a certain directory in hdfs or to get the present working directory?

Jan 7 in Big Data Hadoop by slayer
• 29,170 points
39 views

1 answer to this question.

0 votes

Hadoop has a special file system called 'hdfs' where there is no concept of current or present working directory. And therefore, the hdfs does not support 'cd' command (in short, it is not required). To navigate through the directories in hdfs, the complete path should be provided. This can be done with 'hdfs dfs -ls <path>' command.

Suppose you have a directory named test2 under a directory named test. Now, to view the contents of the test2 directory in hdfs you can execute the below command,

hdfs dfs -ls test/test2

Now, if you have a .txt file in the directory test2 and you want to display the .txt file, then execute the below command,

hdfs dfs -cat test/test2/text_file_name.txt

answered Jan 7 by Omkar
• 67,660 points

Related Questions In Big Data Hadoop

0 votes
1 answer

Getting error in command hdfs dfs -mkdir

You are getting this error because the ...READ MORE

answered Apr 15, 2018 in Big Data Hadoop by Shubham
• 13,310 points
484 views
0 votes
5 answers
0 votes
1 answer

What is the command to navigate in HDFS?

First of all there is no command ...READ MORE

answered Apr 27, 2018 in Big Data Hadoop by Shubham
• 13,310 points
519 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,710 points
3,348 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,710 points
400 views
0 votes
10 answers

hadoop fs -put command?

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

answered Dec 7, 2018 in Big Data Hadoop by Aditya
16,590 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,260 points
1,211 views
0 votes
1 answer

What is the command to count number of lines in a file in hdfs?

hadoop fs -cat /example2/doc1 | wc -l READ MORE

answered Nov 22, 2018 in Big Data Hadoop by Omkar
• 67,660 points
403 views
–1 vote
1 answer

Hdfs command to see available free space in hdfs

Yes, you check the free space using ...READ MORE

answered Jan 21 in Big Data Hadoop by Omkar
• 67,660 points
47 views