Linux rm command guide

  

Among the many commands of Linux system, rm command is mainly used to delete files. The following small series will explain the rm command of Linux system in detail, and hope to help beginners.

Name: rm

Access: All users

use: rm [options] name .. .

Description: Delete files and directories.

Parameters:?

-i Ask for confirmation one by one before deleting.

-f Even if the original file attribute is set to read-only, it is deleted directly, and it is not necessary to confirm one by one.

-r Delete the directory and the following files one by one.

Example:

Delete all C language files; ask for confirmation before deleting:

rm -i *.c

Put the Finished subdirectory and Delete all files in the subdirectory:

rm -r Finished

Description: Delete files or directories.

Syntax: rm [-dfirv][--help][--version][file or directory. . . ]

Additional note: Execute the rm command to delete the file or directory. If you want to delete the directory, you must add the parameter “-r”, otherwise the default will only delete the file.

Parameter:

-d or --directory Delete the hard link data of the directory to be deleted directly into 0 and delete the directory.

-f or --force Forces the deletion of files or directories.

-i or --interactive Ask the user before deleting an existing file or directory.

-r or -R or --recursive Recursive processing, all files and subdirectories under the specified directory are processed together.

-v or --verbose Shows the execution of the instruction.

--help Online help.

--version Displays version information.

The above is the introduction of the Linux system rm command, the simple use of the rm command can only delete files, if you want to delete the directory, you must use rmdir or rm-rf, you remember?

Copyright © Windows knowledge All Rights Reserved