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:
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:
To delete a file in HDFS:
bashhadoop fs -rm /user/username/file.txt
Replace
/user/username/file.txt
with the path to the file you want to delete.To delete an empty directory in HDFS:
bashhadoop fs -rm /user/username/mydirectory
Replace
/user/username/mydirectory
with the path to the empty directory you want to delete.To delete a directory and its contents recursively:
bashhadoop 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.To delete multiple files and directories:
bashhadoop fs -rm /user/username/file1.txt /user/username/file2.txt /user/us
Hadoop Training Demo Day 1 Video:
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