How to Delete a Directory named as a hadoop command in a VM?

Viewed 18

I have accidentally made a directory named -mkdir which a linux command in a VM. Now, I'm unable to remove this directory, I have used the commands hadoop fs -rm -R -mkdir and it is displaying a error illegal action. Anyone can help with this issue.

1 Answers

Use of the -- option is key to removing the direct.

From the same Linux VM that created the direction, do rmdir -- -mkdir. This instructs getop to cease looking for options, so the next file "-mkdir" can be deleted.

$ mkdir -- -mkdir
$ ls -ld -- -mkdir
drwxr-xr-x 2 root root 4096 Sep  7 21:45 -mkdir
$ rmdir -- -mkdir
Related