Linux Common Commands Summary--rm

Source: Internet
Author: User

1. Function: Delete files or folders

2. Usage: RM [options] File or folder

3. Parameters:

-F,--force Force Delete

-I confirm each file before deleting it

-I prompts you once to delete multiple files or to delete them recursively.

--interactive[=when] need to confirm when deleting, have when, once (-i), always (-i) three kinds of options

-R,-R,--recursive to delete files and folders recursively

4. Example

Example 1: In the case of parameters not specified parameter, for each file that needs to be deleted, confirm whether to delete; the directory cannot be deleted by default; the same effect as the specified parameter-I

[[email protected] test]# ls

Test_1 test_1.txt test_2.txt test_3.txt test_mv.txt

[email protected] test]# RM test_*

RM: Cannot delete "test_1": is a directory

RM: Do you want to delete the normal file "Test_1.txt"? Y

RM: Do you want to delete the normal file "Test_2.txt"? Y

RM: Do you want to delete the normal file "Test_3.txt"? Y

RM: Do you want to delete the normal file "Test_mv.txt"? N

[email protected] test]# ls-lh

Total dosage 8.0K

Drwxr-xr-x 3 root root 4.0K May 18:09 test_1

-rw-r--r--1 root root 16 May 18:12 Test_mv.txt

Example 2: Specifying the parameter-I is confirmed only once.

[email protected] test]# rm-i test_*.txt

RM: Delete all parameters? Y

[[email protected] test]# ls

Test_1

[email protected] test]# ls-lh

Total dosage 4.0K

Drwxr-xr-x 3 root root 4.0K May 18:09 test_1

Example 3: Forcing a file file when you specify the-f parameter

[[email protected] test]# ls

Test_1 test_1.txt test_2.txt Test_3.txt

[email protected] test]# rm-f test_*.txt

Example 4: Force the deletion of files and directories using the-RF command.

[[email protected] test]# ls

Test_1 test_1.txt test_2.txt Test_3.txt

[email protected] test]# RM-RF *

[email protected] test]# ls-lh

Total dosage 0


Linux Common command Rollup--rm

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.