Home > Article > Operation and Maintenance > How to delete a directory in linux
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.
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!