I've got a seemingly un-deletable directory in Unix that contains some hidden files with names that start with .panfs
. I'm unable to delete it using either of these commands:
rm -R <dir> rm -Rf <dir>
Does anyone have any suggestions?
To remove a directory and all its contents, including any subdirectories and files, use the rm command with the recursive option, -r . Directories that are removed with the rmdir command cannot be recovered, nor can directories and their contents removed with the rm -r command.
Try cd into the directory, then remove all files using rm -rf * . Then try going out of the directory and use rmdir to delete the directory. If it still displays "Directory not empty" that means that the directory is being used. Try to close it or check which program is using it then re-use the command.
To permanently remove a directory in Linux, use either rmdir or rm command: For empty directories, use rmdir [dirname] or rm -d [dirname] For non-empty directories, use rm -r [dirname]
Try to delete it with root user or use sudo, if you are in trouble
Use rm -rf dir
with root account and it will be deleted, since you should be facing a permissions issue.
To those who prefers to separate the options for a full mastering of their linux command lines so
rm -r -f directory_name
rm → remove
-r → recursively
-f → force (includes chmod permissions)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With