The command to delete files in ubuntu - rm

1, rmdir: delete the entire folder

When using the rmdir command to delete a directory, you need to leave the deleted directory, and the deleted directory must be empty , otherwise the deletion will fail.

rmdir test  //删除空文件夹,test为文件夹名

2. rm command: delete a file or directory, it cannot be restored after deletion

Use the rm command to delete a file. Once deleted, it cannot be recovered.

Some parameters can be used to assist deletion during deletion:

  1. -f: Forced deletion without prompt
  2. -r: Recursively delete the contents of the directory
  3. -i: interactive mode, prompt whether to delete

example:

  1. Delete the test.txt file:sudo rm test.txt
  2. Delete the test folder: sudo rm -r test(the -r parameter must be used)
  3. Forcibly delete all files under the test folder directory:sudo rm -rf test

Guess you like

Origin blog.csdn.net/qq_43619058/article/details/124164657