How to Use RM commands in Linux

Source: Internet
Author: User

How to Use RM commands in Linux --- How to delete files or directories in Linux

Users can useRmCommand to delete unnecessary files. This command is used to delete one or more files or directories in a directory. It can also delete a directory and all its files and subdirectories. For linked files, the link is closed, and the original file remains unchanged.

RmThe command is generally in the following format:Rm[Option]... directory... Delete the specified <File> (unlink ).

-D -- Directory: delete directories that may still have data (only for Super Users)

-F -- force: the file does not exist and no information is displayed.

-I -- Interactive must be confirmed before any deletion operation.

-R/r -- Recursive: delete all directory layers under the directory at the same time

-V -- verbose detailed display steps

-- Help: displays the help information and leaves

-- Version: displays the version information and leaves.

To delete an object whose first character is '-' (for example, '-foo'), use one of the following methods:
Rm---Foo

Rm./-Foo

Note that if you use RM to delete a file, you can restore it to its original state. If you want to ensure
The content of this file cannot be restored. Please use shred.

Example:

Delete all RB program files. Before deletion, ask for confirmation one by one:
Rm-I *. Rb

Delete all files in the finished subdirectory and subdirectory:
Rm-r finished

Delete the finished sub-directory and all files in the sub-directory, and do not need to -- OK:

Rm-RF finished

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.