How to delete a folder in linux

Release: 2019-12-30 10:46:12
Original
8553 people have browsed it

How to delete a folder in linux

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
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!