Hadoop fs rm

Share

                          Hadoop fs rm

In Hadoop, you can use the hadoop fs -rm command to delete files or directories from the Hadoop Distributed File System (HDFS). This command allows you to remove data stored in HDFS. Here’s how you can use it:

The basic syntax of the hadoop fs -rm command is as follows:

bash
hadoop fs -rm [-r] <hdfs-path>
  • [-r]: This is an optional flag that indicates a recursive delete. If you want to delete a directory and its contents, you should use the -r flag.

  • <hdfs-path>: This is the path in HDFS pointing to the file or directory you want to delete.

Here are some examples of using the hadoop fs -rm command:

  1. To delete a file in HDFS:

    bash
    hadoop fs -rm /user/username/file.txt

    Replace /user/username/file.txt with the path to the file you want to delete.

  2. To delete an empty directory in HDFS:

    bash
    hadoop fs -rm /user/username/mydirectory

    Replace /user/username/mydirectory with the path to the empty directory you want to delete.

  3. To delete a directory and its contents recursively:

    bash
    hadoop fs -rm -r /user/username/mydirectory

    Replace /user/username/mydirectory with the path to the directory you want to delete along with all its contents.

  4. To delete multiple files and directories:

    bash
    hadoop fs -rm /user/username/file1.txt /user/username/file2.txt /user/us

Hadoop Training Demo Day 1 Video:

 
You can find more information about Hadoop Training in this Hadoop Docs Link

 

Conclusion:

Unogeeks is the No.1 IT Training Institute for Hadoop Training. Anyone Disagree? Please drop in a comment

You can check out our other latest blogs on Hadoop Training here – Hadoop Blogs

Please check out our Best In Class Hadoop Training Details here – Hadoop Training

💬 Follow & Connect with us:

———————————-

For Training inquiries:

Call/Whatsapp: +91 73960 33555

Mail us at: info@unogeeks.com

Our Website ➜ https://unogeeks.com

Follow us:

Instagram: https://www.instagram.com/unogeeks

Facebook:https://www.facebook.com/UnogeeksSoftwareTrainingInstitute

Twitter: https://twitter.com/unogeeks


Share

Leave a Reply

Your email address will not be published. Required fields are marked *