Rm command details, rm details

Source: Internet
Author: User

Rm command details, rm details
1. Command description:

The rm command is used to remove one or more files or directories.

2. Syntax:

Rm [Option]... file list...

3. instance:

(1) rm-I dev1? ? Delete the dev1 file. The-I option indicates that users are asked before deleting files or directories.

[Root @ CentOS opt] # Total ll usage 1516-rw-r -- r --. 1 root 0 February 20 15:43 dev1-rw-r -- r --. 1 root 0 February 20 15:43 dev2-rw-r -- r --. 1 root 0 February 20 15:43 dev3-rw-r -- r --. 1 root 0 February 20 15:43 dev4-rw-r -- r --. 1 root 0 February 20 15:43 dev5drwxrwxr-x. 6 root 4096 May 17 2017 redis-3.2.9-rw-r -- r --. 1 root 1547695 May 17 2017 redis-3.2.9.tar.gzdrwxr-xr-x. 2 root 6 December 2015 rh [root @ CentO S opt] # rm-I dev1 ???? # Before deleting a file, you will first ask the user rm: Do you want to delete a common empty file "dev1 "? Y [root @ CentOS opt] # ll total usage 1516-rw-r -- r --. 1 root 0 February 20 15:43 dev2-rw-r -- r --. 1 root 0 February 20 15:43 dev3-rw-r -- r --. 1 root 0 February 20 15:43 dev4-rw-r -- r --. 1 root 0 February 20 15:43 dev5drwxrwxr-x. 6 root 4096 May 17 2017 redis-3.2.9-rw-r -- r --. 1 root 1547695 May 17 2017 redis-3.2.9.tar.gzdrwxr-xr-x. 2 root 6 December 2015 rh [root @ CentOS opt] #

(2) rm-f dev2 dev3? ? Delete dev2 and dev3 files. The "-f" option indicates that files or directories are forcibly deleted (users are not asked ).

[Root @ CentOS opt] # Total ll usage 1516-rw-r -- r --. 1 root 0 February 20 15:43 dev2-rw-r -- r --. 1 root 0 February 20 15:43 dev3-rw-r -- r --. 1 root 0 February 20 15:43 dev4-rw-r -- r --. 1 root 0 February 20 15:43 dev5drwxrwxr-x. 6 root 4096 May 17 2017 redis-3.2.9-rw-r -- r --. 1 root 1547695 May 17 2017 redis-3.2.9.tar.gzdrwxr-xr-x. 2 root 6 December 2015 rh [root @ CentOS opt] # rm-f dev2 dev3 ???? # Force Delete dev2, dev3 file [root @ CentOS opt] # ll total usage 1516-rw-r -- r --. 1 root 0 February 20 15:43 dev4-rw-r -- r --. 1 root 0 February 20 15:43 dev5drwxrwxr-x. 6 root 4096 May 17 2017 redis-3.2.9-rw-r -- r --. 1 root 1547695 May 17 2017 redis-3.2.9.tar.gzdrwxr-xr-x. 2 root 6 December 2015 rh [root @ CentOS opt] #

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.