Latest web development tutorials

Linux rm command

Linux rm command

Linux command Daquan Linux command Daquan

Linux rm command to delete a file or directory.

grammar

rm [options] name...

Parameters:

  • -i Asked to confirm before deleting one by one.
  • -f even if the original file attribute is set to read-only, but also directly removed, one by one without confirmation.
  • -r directory and below the archives also removed one by one.

Examples

You can delete files directly using the rm command if you must delete the directory with the option "-r", for example:

# rm  test.txt 
rm:是否删除 一般文件 "test.txt"? y  
# rm  homework  
rm: 无法删除目录"homework": 是一个目录  
# rm  -r  homework  
rm:是否删除 目录 "homework"? y 

Delete all files in the current directory and directory, the command line:

rm  -r  * 

Once the file is deleted by the rm command, it can not be recovered, so you must be careful to use this command.

Linux command Daquan Linux command Daquan