Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of deleting folder under linux

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail the method of deleting folders under linux. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

How to delete a folder under linux: you can delete it using the [rm-rf directory name] command, such as [rm-rf / var/log/httpd/access], which means deleting the / var/log/httpd/access directory and all files and folders under it.

Rm is fine, but you need to add two parameters-rf:

Rm-rf directory name

-r is recursive downwards, and no matter how many directories there are, delete them as well.

-f means to delete directly and forcibly without giving any hints.

For example: delete a 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 this way directly, the system may not authorize this operation and give a Permission denied prompt.

At this point, it is necessary to add sudo as the license for the authorized operation before rm-rf, that is, the name of the sudo rm-rf folder)

For example: delete file instance:

Rm-f / var/log/httpd/access.log

The / var/log/httpd/access.log file will be forcibly deleted

One thing to remind you: you must be very careful when using this rm-rf. Linux does not have a recycle bin.

Of course, rm has more parameters and usage that can be viewed by man rm.

This is the end of the method of deleting folders under linux. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 278

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report