Get the App
SLTechnology News&Howtos  ›  Servers  › 

The method of deleting folder by linux

Shulou Source: shulou.com Published: 2022-06-03 04:10:37 09月22日 Update

Linux

Linux, whose full name is GNU/Linux, is a set of Unix-like operating system that is free to use and spread freely. It is a multi-user, multi-task, multi-thread and multi-CPU operating system based on POSIX and Unix. With the development of the Internet, Linux has received support from software enthusiasts, organizations and companies all over the world. In addition to maintaining a strong momentum of development in servers, it has made great progress in personal computers and embedded systems. Users can not only intuitively obtain the implementation mechanism of the operating system, but also modify and improve Linux according to their own needs to maximize meet the needs of users.

1. Rm directly is fine, but 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 prompt.

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

2. Use the rmdir command

The Linux rmdir command deletes the empty directory.

Grammar

Rmdir [- p] dirName

Parameters:

-p is deleted when the subdirectory is deleted so that it is also empty.

Example

Delete the subdirectory named AAA under 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 the Test is deleted, the BBB will also be deleted.

Rmdir-p BBB/Test

These are the details of how to delete the folder in linux. Please follow other related articles for more information.

Tags: Directories files systems folders operating systems subdirectories that is parameters commands instances users empty directories development work support strong maximum intuitive free Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Shulou Tech Info Shulou Information Microsoft OPPO Reno