Now let us get into commands related to managing files in HDFS. It includes deleting files, copying files as well as HDFS File Permissions.
Deleting Files from HDFS
Let us see how we can delete files from HDFS.
- As we have already copied data into HDFS, let us start with deleting files using
hadoop fs -rmcommand.
- When we use rm command, files will be copied to .Trash directory by default. It acts as recycle bin to overcome issue of deleting files accidentally.
- We can use -skipTrash to skip recycle bin and delete data permanently. However, it cannot be undone.
- .Trash can be cleaned up manually by users belonging to superuser group such as HDFS or automatically based on trash related properties defined in core-site.xml.