What are the ways for linux to delete a folder
What are the ways to delete linux folders? In response to this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more small partners who want to solve this problem find a simpler and easier way.
Direct rm can be, but to add two parameters-rf, that is: rm -rf directory name
-r is recursion down, no matter how many levels of directories, delete them together;
-f means to delete directly without any prompt.
Example: Delete folder instance:
rm -rf /var/log/httpd/access
The/var/log/httpd/access directory and all files and folders under it will be deleted.
(There may be a problem here, if you use it directly, the system may not authorize this operation, and a Permission denied prompt will appear.)
At this time, you need to add sudo before rm -rf as permission for authorized operations, i.e. sudo rm -rf folder name)
Example: Delete file instance:
rm -f /var/log/httpd/access.log
The file/var/log/httpd/access.log will be forcibly deleted
Need to remind is: use this rm-rf time must be extra careful, linux has no recycle bin.
Of course, rm has more parameters and usage, man rm can be viewed.
There is another way that works:
mkdir a create directory armdir a delete directory a note: rmdir can only delete empty directory, if there are files in the directory, then delete failed about linux delete folder method what questions to share here, hope the above content can have some help for everyone, if you still have a lot of doubts not solved, you can pay attention to industry information channel to learn more related knowledge.