Rm
1. Command Format
usage : RM [Options] File ...
CD [directory name ]
2. Command function
Delete one or more files or directories in a directory , RM does not delete if the-r option is not used except the directory. If you use RM to delete a file, you can usually still restore the file to its original state.
3 command parameters and instances
- F,--force ignores nonexistent files and never gives hints.
-I ,--interactive for interactive deletion
-r, -r , --recursive instructs RM to recursively delete all directories and subdirectories listed in the parameter
--help Display This help message and exit
--version Output version information and exit
#####################################################################
Example One: Delete file , the system will first ask whether to delete.
Command:
RM file name
RM a.txt
[[email protected] /]# cd /data[[email protected] data]# lsadmin.log b.txt dcp jim lucy super team test2 youa.txt c.txt dong link_a.txt Pbc.bmp teacher test1 test.txt[[email protected] data]# rm a.txtrm: remove regular file ' a.txt '? y[[email protected] data]# find /data -name "A.txt" [[email protected] data]# lsadmin.log c.txt dong link_a.txt pbc.bmp teacher test1 test.txtb.txt dcp jim lucy super team test2 you[[email protected] data]#
Example 2 : will be Data subdirectories and subdirectories in all file Delete , and do not ask
Command:
Rm-r F/data
[[email protected] data]# Rm-rf/data[[email protected]/]# LSA boot home lost+found opt sbin sys test 3 Varbackup Dev Lib media proc selinux test tmp vmwarebin etc lib64 mnt root srv Test1 Usr[[email protected]/]#
This article is from the "Qin Xian son" blog, please make sure to keep this source http://youdong.blog.51cto.com/3562886/1718146
Linux Basic Command Learning RM (6)