Home >Operation and Maintenance >Linux Operation and Maintenance >How to delete a directory in linux

How to delete a directory in linux

藏色散人
藏色散人Original
2021-12-15 17:18:3924225browse

How to delete a directory in Linux: 1. Open a terminal command window; 2. Delete the specified directory by executing the "rm -rf folder name" command.

How to delete a directory in linux

The operating environment of this article: linux5.9.8 system, Dell G3 computer.

How to delete a directory in Linux?

Linux quickly delete a directory:

Command line rm -rf folder name

Extended information:

1. The Linux rm command is used to delete a file or directory.

2. Syntax: rm [options] name...

3. Parameters: -i Ask for confirmation one by one before deleting; -f delete directly even if the original file attribute is set to read-only , no need to confirm one by one; -r will also delete the files in the directory and below one by one.

4. Example: You can use the rm command directly to delete files. If you want to delete a directory, you must use the option "-r", for example: # rm -r homework rm: Do you want to delete the directory "homework"? y

5. Delete all files and directories in the current directory. The command line is: rm -r *

6. Once a file is deleted through the rm command, it cannot be recovered, so this command must be used with extreme caution.

Recommended learning: "linux video tutorial"

The above is the detailed content of How to delete a directory in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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