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] #