How to list files in hadoop?

Ads
 

How to list files in hadoop?

Hi,

I want to list the files from a directory in HDFS. How to list files in hadoop?

Thanks

View Answers

May 13, 2017 at 7:27 PM

Hi,

Hadoop uses its own file system which is know as Hadoop File System or HDFS.

Hadoop provides commands to interact with the HDFS. To list down all the file in a directory you can use the following command:

hadoop fs -ls /

Above command lists all the files from the root of HDFS.

Sample output:

[email protected]:/home/deepak$ hadoop fs -ls /
Found 11 items
drwxrwxrwx   - yarn   hadoop          0 2017-05-13 18:33 /app-logs
drwxr-xr-x   - hdfs   hdfs            0 2016-04-26 19:30 /apps
drwxr-xr-x   - yarn   hadoop          0 2016-04-25 20:57 /ats
drwxr-xr-x   - hdfs   hdfs            0 2016-04-25 20:58 /hdp
drwxr-xr-x   - mapred hdfs            0 2016-04-25 20:58 /mapred
drwxrwxrwx   - mapred hadoop          0 2016-04-25 20:58 /mr-history
drwxrwxrwx   - spark  hadoop          0 2017-05-13 19:26 /spark-history
drwxr-xr-x   - hdfs   hdfs            0 2017-05-13 10:51 /system
drwxr-xr-x   - hdfs   hdfs            0 2017-05-11 22:52 /test
drwxrwxrwx   - hdfs   hdfs            0 2016-04-25 21:02 /tmp
drwxr-xr-x   - hdfs   hdfs            0 2017-05-13 18:33 /user
[email protected]:/home/deepak$

Check more at Hadoop shell commands.

Thanks

Ads









Related Tutorials/Questions & Answers:
How to list files in hadoop?
How to print list of files in client system
Advertisements
ModuleNotFoundError: No module named 'hadoopy'
List files recursively in linux
FTP Server : List Files and Directories
Retrieving list of uploaded files.
ModuleNotFoundError: No module named 'list-files'
FTP Server: List all files name
ModuleNotFoundError: No module named 'list-files-py'
How to show only hidden files in Terminal?
How to show only hidden files in Terminal?
How to show only hidden files in Terminal?
how to backup files and folder with Java
how to creating hbm files in hibernate using Myeclipse
How do I decompile Java class files?
How to upload files to server using JSP/Servlet?
How to avoid Java Code in JSP-Files?
how to download the uploaded folder files using jsp
How To Write the FORM Tag Correctly for Uploading Files?
How to delete files in Java?
how to read and write xml files in javascript
how to search a text in all files in a folder in unix
how to search a text in all files in a folder in unix
how to search a text in all files in a folder in unix
how to search a text in all files in a folder in unix
How to Convert Text Files into Gzip File
how to read files of directory objective c
How to resume scp with partially copied files
How to convert multiple files in java to .zip format
how to list volumes in docker
How to list databases in PostgreSQL

Ads