Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hadoop file system change directory command

Tags:

hadoop

I was going through the HADOOP fs commands list. I am little perplexed not to find any "cd" command in hadoop fs.

Why is it so? It might sound silly question for the HADOOP users, but as I am beginner I can not understand why there is no list of cd command in HADOOP fs level?

like image 791
user4221591 Avatar asked Nov 21 '14 06:11

user4221591


People also ask

How do I move a file from one directory to another in Hadoop?

You can use the cp command in Hadoop. This command is similar to the Linux cp command, and it is used for copying files from one directory to another directory within the HDFS file system.

How do I find my HDFS directory?

Using the ls command, we can check for the directories in HDFS. Hadoop HDFS mkdir Command Description: This command creates the directory in HDFS if it does not already exist.

Which command is used to make a directory in Hadoop?

mkdir: This is no different from the UNIX mkdir command and is used to create a directory on an HDFS environment.

What is HDFS DFS command?

In Hadoop, hdfs dfs -find or hadoop fs -find commands are used to get the size of a single file or size for all files specified in an expression or in a directory. By default, it points to the current directory when the path is not specified. $hadoop fs -find / -name test -print or $hdfs dfs -find / -name test -print.


2 Answers

Think about it like this:

Hadoop has a special file system called "hdfs" which runs on top of existing say linux file system. There is no concept of current or present working directory a.k.a. pwd

Let's say we have following structure in hdfs:

d1/
  d2/
     f1
  d3/
     f2
     d4/
       f3

You could do cd in your Linux file system from moving from one to the other but do you think changing directory in hadoop would makes sense? HDFS is like virtual file system and you dont directly interact with hdfs except via hadoop command or job tracker.

like image 188
SMA Avatar answered Sep 28 '22 01:09

SMA


HDFS provides various features that enable accessing HDFS(Hadoop Filesystem) easy on local machines or edge nodes. You have an option to mount HDFS using any of the following methods. Once Hadoop file system is mounted on your machine, you may use cd command to browse through the file system (It's is like mounting remote network filesystem like NAS)

  • Fuse dfs (Available from Hadoop 0.20 onwards )
  • NFSv3 Gateway access to HDFS data (Available from Hadoop version
    Hadoop 2.2.0)
like image 27
SachinJ Avatar answered Sep 28 '22 00:09

SachinJ