What is the linux rm command?

藏色散人
藏色散人Original
2020-05-29 10:18:595127browse

What is the linux rm command?

What is the linux rm command?

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

Recommended: "linux tutorial"

Syntax

rm [options] name...

Parameters:

-i Before deletion Ask for confirmation one by one.

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

-r Delete the files in the directory and below one by one.

Example

To delete files, you can use the rm command directly. If you want to delete a directory, you must use the option "-r", for example:

# rm  test.txt 
rm:是否删除 一般文件 "test.txt"? y  
# rm  homework  
rm: 无法删除目录"homework": 是一个目录  
# rm  -r  homework  
rm:是否删除 目录 "homework"? y

Delete all files in the current directory and Directory, command line:

rm  -r  *


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

The above is the detailed content of What is the linux rm 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