O'Reilly logo

Hadoop Operations and Cluster Management Cookbook by Shumin Guo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Manipulating files on HDFS

Besides commands to copy files from the local directory, HDFS provides commands to operate on files. In this section, we will show you how to operate files, such as downloading files from HDFS, checking the content of files, and removing files from HDFS.

Getting ready

We assume that our Hadoop cluster has been properly configured and all the daemons are running without any issues.

How to do it...

Perform the following steps to check the status of files and the directory on HDFS:

  1. List files of the user's home directory on HDFS using the following command:
    hadoop fs -ls .
    

    For example, this command will give the following output on my machine:

    Found 7 items
    drwx------ - hduser supergroup 0 2013-02-21 22:17 /user/hduser/.staging ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required