The RM command in Linux is detailed

Source: Internet
Author: User

---linux delete files or directories command using Linux under RM command

Users can use the RM command to delete unwanted files. The function of this command is to delete one or more files or directories in a directory, and it can delete all files and subdirectories under a directory. For linked files, only the link is broken, the original file remains unchanged.

The general form of the RM command is:rm [Options] ... Directory... Deletes the specified < file > (that is, unlink).

-D--directory Delete directories that may still have data (super users only)

-F--force Skip files that do not exist, do not display any information, force delete

-I--interactive must confirm before any delete operation

-R/R--recursive Delete all directory tiers in this directory at the same time

-V--verbose detailed display of the steps performed

--HELP Display this help message and leave

--version display version information and leave

PS1: The best use of the command is RM-RF <filename>, OK to delete, change the command whether it is a folder or file will be directly forced to delete.

PS2:RM simultaneously delete multiple files command: RM <filename1> <filename2>

To delete a file with the first character '-' (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 usually still restore the file to its original state. If you want to make sure
The contents of this file cannot be restored, please consider using shred.

Example:

Delete all RB language programs; Ask for confirmation before deleting:
RM -I *.RB

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

Delete all files in the finished subdirectory and subdirectories, and do not-confirm:

Rm-rf finished

The RM command in Linux is detailed

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.