Under linux rm delete non-empty directory

  

rm command Creating files in linux is very easy, there will be files at any time in the system become obsolete and useless. Users can delete it with the rm command. The function of this command is to delete one or more files or directories in a directory. It can also delete a directory and all files and subdirectories under it. For linked files, just delete the link and the original file remains the same. The general form of the rm command is: rm [options] file … rm does not delete directories if the -r option is not used. The options for this command have the following meanings: - f Ignore files that do not exist and never give a prompt. -r Instructs rm to recursively delete all directories and subdirectories listed in the parameter. - i Perform an interactive delete. Use the rm command with extra care. Because once a file is deleted, it cannot be recovered. For example, when the user enters cp, mv or other commands, the rm command is accidentally entered. When the user presses the Enter key and recognizes his or her mistake, it is too late and the file is gone. To prevent this from happening, you can use the i option in the rm command to confirm each file you want to delete. If the user enters y, the file will be deleted. If you enter anything else, the file will be retained. In the next example, the user wants to delete the files test and example. You will then be asked to confirm each file. The user finally decides to delete the example file and keep the test file. $ rm – ii test example

Copyright © Windows knowledge All Rights Reserved