【Linux】命令 - rm

Posted by 西维蜀黍 on 2020-09-06, Last Modified on 2022-12-10

rm -f - force - 强行删除

Attempt to remove the files without prompting for confirmation, regardless of the file’s permissions. If the file does not exist, do not display a diagnostic message or modify the exit status to reflect an error. The -f option overrides any previous -i options.

rm -d - directory - 删除文件夹

Attempt to remove directories as well as other types of files.

rm -i - interactive - 交互模式

Request confirmation before attempting to remove each file, regardless of the file’s permissions, or whether or not the stan- dard input device is a terminal. The -i option overrides any previous -f options.

rm -r/-R - recursive 递归操作

Attempt to remove the file hierarchy rooted in each file argument. The -R option implies the -d option. If the -i option is specified, the user is prompted for confirmation before each directory’s contents are processed (as well as before the attempt is made to remove the directory). If the user does not respond affirmatively, the file hierarchy rooted in that directory is skipped.

rm -v - verbose

Be verbose when deleting files, showing them as they are removed.

Reference