Get the App
SLTechnology News&Howtos  ›  Servers  › 

What are the commands for linux to delete a folder

Shulou Source: shulou.com Published: 2022-06-01 23:52:20 09月27日 Update

This article mainly introduces what the linux delete folder commands are, the article is very detailed, has a certain reference value, interested friends must read it!

Linux delete folder command: 1, rmdir command, use "rmdir [- p] folder name" to delete the empty specified folder; 2, rm command, use "rm-rf folder name" to delete the specified folder.

Linux delete folder

1. Use the rmdir command

The Linux rmdir command deletes empty directories.

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

2. Use the rm command

The Linux rm (English spelling: remove) command is used to delete a file or directory.

Grammar

Rm [options] name...

Parameters:

-I ask for confirmation one by one before deletion.

-f even if the original file attribute is set to read-only, it will be deleted directly without confirmation one by one.

-r delete the directory and the following files one by one.

Example:

Rm-rf / var/log/httpd/access

The / var/log/httpd/access directory and all files and folders under it will be deleted

The above is all the contents of the article "what are the linux commands to delete folders?" Thank you for your reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Files commands folders directories spelling contents parameters subitems subdirectories files articles grammar English read-only values interests examples guys buddies attributes Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux vpn Huawei macOS Microsoft