Home>Article>Operation and Maintenance> linux delete folder command

linux delete folder command

藏色散人
藏色散人 Original
2019-06-06 09:13:19 4751browse

linux delete folder command

Linux delete folder command

Deleting a directory in Linux is very simple. Many people are still accustomed to using rmdir, but once If the directory is not empty, you will be in deep trouble. Now use the rm -rf command.

Just rm directly, but you need to add two parameters -rf, namely: rm -rf directory name

Delete directories and files rm(remove)

Function Description: Delete files or directories.

Syntax:

rm [-dfirv][--help][--version][文件或目录...]

Supplementary instructions: Execute the rm command to delete files or directories. If you want to delete a directory, you must add the parameter "-r", otherwise the default is only Files will be deleted.

Parameters:

-d or –directory Directly delete the hard link data of the directory to be deleted to 0 and delete the directory.

-f or –force Forcefully delete files or directories.

-i or –interactive Ask the user before deleting existing files or directories.

-r or -R or –recursive Recursive processing, processing all files and subdirectories in the specified directory together.

-v or –verbose Display the instruction execution process.

1. Delete the folder

de>rm -rf fileNamede>

-Delete the folder instance:

rm -rf /var/log/httpd/access

will delete the /var/log/httpd/access directory and All files and folders under it

need to be reminded: be extra careful when using this rm -rf, Linux does not have a recycle bin

2. Delete files

de>rm -f fileNamede>

Be extra careful when using rm -rf, Linux does not have a recycle bin

Recommended video tutorials: "Linux Tutorial"

The above is the detailed content of linux delete folder command. 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