rm: delete a file or directory

When you delete a file or directory using the rm command, the system will not produce any message. The basic format of the command is: RM [option] file or directory

Options:

  • -f: the opposite force the deletion (force), and the -i option, use -f, the system will not ask, but directly delete the target file or directory.
  • -i: and -f contrary, before deleting a file or directory, the system will give prompt information, use the -i can effectively prevent accidentally deleting useful files or directories.
  • -r: recursive delete, mainly used to delete a directory, delete the specified directory and all types of content, including all subdirectories and files.

rm command is a destructive command has, because rm command will permanently delete files or directories, which means that if there are no files or directories to back up, once the rm command to remove it, you can not recover, therefore, Especially when you delete a directory using the rm command, be cautious.

 

rm command if not add any options, the default execution is "rm -i filename" , that is, will be asked whether to delete before deleting a file.

If there are 10,000 subdirectories or files you want to delete sub-directory, then the ordinary rm delete confirmation requires a minimum of 10,000 times. So, delete files in real time, we will choose to force the removal of:

mkdir -p / the Test / LM / Movie / jp 

RM -rf / the Test 
# forcibly remove, once and for all

Although "-rf" options are used to delete a directory, but will not delete the file error. So, for ease of use, generally either delete the file or delete directory will direct the use of "-rf" options.

 

Guess you like

Origin www.cnblogs.com/pacino12134/p/11481666.html