Reputation:
I ssh to the debvox that it for Hadoop and if I saay hadoop fs -ls
I get a lot of files including
drwxr-xr-x - root hadoop 0 2013-07-11 17:49 sandeep
drwxr-xr-x - root hadoop 0 2013-04-10 14:13 testprocedure
drwxr-xr-x - root hadoop 0 2013-04-03 13:56 tmp
I need to go inside that tmp folder, took a look at Hadoop shell commands in here but still didn't find the command for it. http://hadoop.apache.org/docs/r0.18.3/hdfs_shell.html
So what's the command to go to that folder?
Upvotes: 2
Views: 7820
Reputation: 7990
First you need to check if you have hadoop access or not. if yes then use command :
[yourhost]$ hadoop fs -ls /dir1/
It will list directory or file which is inside dir1
Upvotes: 1
Reputation: 34184
I need to go inside that tmp folder, took a look at Hadoop shell commands in here but still didn't find the command for it. http://hadoop.apache.org/docs/r0.18.3/hdfs_shell.html
There is nothing like cd which can take us inside a directory. So you can't go to that folder like you can do in your local FS. You could probably use ls a others have suggested, but that just list the content inside a directory and doesn't take you to that directory. If you really want to go inside a particular directory, you could make use of the HDFS WebUI. You can point your web browser to NameNode_Machine:50070 to go there. It allows you to browse the entire HDFS. You can view and download the files as well.
Upvotes: 2
Reputation: 11721
Specify the directory name, as follows:
hadoop fs -ls tmp
Sample output from my Demo VM:
hadoop fs -ls
[cloudera@localhost ~]$ hadoop fs -ls
Found 12 items
-rw-r--r-- 1 cloudera supergroup 46 2013-06-18 21:18 /user/cloudera/FileWrite.txt
-rw-r--r-- 1 cloudera supergroup 13 2013-06-18 15:34 /user/cloudera/HelloWorld.txt
drwxr-xr-x - cloudera supergroup 0 2013-07-01 22:07 /user/cloudera/hiveext
drwxr-xr-x - cloudera supergroup 0 2012-06-12 15:10 /user/cloudera/input
-rw-r--r-- 1 cloudera supergroup 176 2013-06-18 23:07 /user/cloudera/input_data.txt
drwxr-xr-x - cloudera supergroup 0 2012-09-06 15:44 /user/cloudera/movies_input
drwxr-xr-x - cloudera supergroup 0 2012-09-06 17:02 /user/cloudera/movies_output
drwxr-xr-x - cloudera supergroup 0 2012-09-06 14:53 /user/cloudera/output
drwxr-xr-x - cloudera supergroup 0 2013-07-01 23:45 /user/cloudera/sample_external_input
-rw-r--r-- 1 cloudera supergroup 16 2012-06-14 01:39 /user/cloudera/test.txt
drwxr-xr-x - cloudera supergroup 0 2012-06-13 00:00 /user/cloudera/weather_input
drwxr-xr-x - cloudera supergroup 0 2012-06-13 15:13 /user/cloudera/weather_output
When I specify a directory hadoop fs -ls sample_external_input
:
[cloudera@localhost ~]$ hadoop fs -ls sample_external_input
Found 2 items
-rw-r--r-- 1 cloudera supergroup 61 2013-07-01 23:17 /user/cloudera/sample_external_input/sample_external_data.txt
-rw-r--r-- 1 cloudera supergroup 13 2013-07-01 23:18 /user/cloudera/sample_external_input/sample_external_data2.txt
Upvotes: 3
Reputation: 22915
If you specify nothing after -ls
, then the folders will be those in your "home" directory. If you want to give a path relative to your home folder, you can do so
hadoop fs ls tmp/someTmpStuff
(assuming tmp is a folder in your home directory ) or use a fully qualified path
hadoop fs ls /user/me/tmp/someTmpStuff
Upvotes: 1