The RM command for the CentOS Linux system command

Source: Internet
Author: User
Tags syslog



RM command, delete command, can be a file and directory, its function is to delete one or more files or directories in a directory, it can also delete a directory and all the files and subdirectories below it. For linked files, only the links are deleted and the original files remain unchanged.

Command format

RM [ Options ] file or directory

Parameter options:

-F,--force Force Delete, no matter if there are files, do not prompt

-V,--verbose detailed display of the removal steps

-I,--interactive Prompt before deleting, interactive

-r,-r,--Recursive Delete the directory, and recursively delete all directories and subdirectories in the parameters.

--help Display Help information

--version output Version information

Command instance:

1), delete the file 1.txt, the system will ask whether to delete.

command:RM 1.txt

[Email protected]~]# ll

Total Dosage 72

-rwx------1 root root 39915 8 months 11:34 1.txt

Drwxr-xr-x 3 root root 4096 8 months 24 06:59 222

-rw-r--r--1 root root 0 8 months 06:54 2.txt

-RW-------. 1 root root 948 8 months 16:09 anaconda-ks.cfg

-rw-r--r--1 root root 2708 8 months 08:38 and print on Thestandard output

-rw-r--r--. 1 root root 14945 8 months 16:09 install.log

-rw-r--r--. 1 root root 3482 8 months 16:05 install.log.syslog

[Email protected]~]# rm 1.txt

RM: Do you want to delete the normal file "1.txt"? y[ Enter y to confirm deletion ]

[Email protected] ~]#

2), forcibly delete file 1.txt, and do not prompt

command:rm–f 1.txt

[[Email protected]~]# Touch 1.txt

[Email protected]~]# ll

Total Dosage 32

-rw-r--r--1 root root 0 8 month 12:12 1.txt

Drwxr-xr-x 3 root root 4096 8 months 24 06:59 222

-rw-r--r--1 root root 0 8 months 06:54 2.txt

-RW-------. 1 root root 948 8 months 16:09 anaconda-ks.cfg

-rw-r--r--1 root root 2708 8 months 08:38 and print on Thestandard output

-rw-r--r--. 1 root root 14945 8 months 16:09 install.log

-rw-r--r--. 1 root root 3482 8 months 16:05 install.log.syslog

[Email protected]~]# rm-f 1.txt

[Email protected] ~]#

3), the 222 directory and all files from the directory are deleted, the deletion process will continue to ask whether to delete.

command:rm–r 222

[email protected] ~]# LL

Total Dosage 32

Drwxr-xr-x 3 root root 4096 8 months 24 06:59 222

-rw-r--r--1 root root 0 8 months 06:54 2.txt

-RW-------. 1 root root 948 8 months 16:09 anaconda-ks.cfg

-rw-r--r--1 root root 2708 8 months 08:38 and print on Thestandard output

-rw-r--r--. 1 root root 14945 8 months 16:09 install.log

-rw-r--r--. 1 root root 3482 8 months 16:05 install.log.syslog

[[Email protected]~]# rm-r 222

RM: Do you want to enter the directory "222"? y

RM: Do you want to enter the directory "222/123"? y

RM: Do you want to delete the plain empty file "222/123/2.txt"? y

RM: Do you want to delete the plain empty file "222/123/1.txt"? y

RM: Do you want to enter the directory "222/123/123"? y

RM: Do you want to delete the plain empty file "222/123/123/1.txt"? y

RM: Do you want to delete the directory "222/123/123"? y

RM: Do you want to delete the directory "222/123"? y

RM: Do you want to delete the directory "222"? y

[Email protected] ~]#




RM command to delete a file or directory is, the-f parameter is forcibly deleted and does not prompt,-R is a recursive delete directory,-fr when used together, delete the recursive directory when not prompted.

This article is from the "Eight Miles Bridge" blog, please be sure to keep this source http://baliq.blog.51cto.com/5984262/1688229

The RM command for the CentOS Linux system command

Related Article

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.