1. Just rm directly, but you need to add two parameters -rf, namely: rm -rf directory name
-r means downward recursion, regardless of whether How many levels of directories should be deleted together?
-f means to delete directly without any prompts.
Delete folder instance:
rm -rf /var/log/httpd/access
will delete /var/log /httpd/access directory and all files and folders under it
Recommended learning:linux tutorial
2. Use the rmdir command
Linux rmdir command Delete empty directories.
Syntax
rmdir [-p] dirName
Parameters:
-p means that when a subdirectory is deleted and it becomes an empty directory, it will be deleted as well.
Example
Delete the subdirectory named AAA in the working directory:
rmdir AAA
In the BBB directory under the working directory, delete the subdirectory named Test. If the BBB directory becomes empty after Test is deleted, BBB will also be deleted.
rmdir -p BBB/Test
The above is the detailed content of How to delete a folder in linux. For more information, please follow other related articles on the PHP Chinese website!