Command [Linux] delete folders and files

Delete empty directories: rmdir = the Remove Directory
can use the rmdir command to delete a empty directory , if the directory is not empty you will be prompted to delete failed.

Delete files: rm = the Remove
can use rm to delete files or directories. Be careful with the rm command, you can not recover the deleted files. To way accidentally deleted files, you can use the rm -i parameter to confirm the files to delete one by one.
-r identify recursive down, no matter how many level directory, be deleted
-f identifies forcibly removed directly, without any prompting meaning

Delete Files

# Will be forced to delete files /var/log/test.log 
RM -f /var/log/test.log

Delete the folder

# Deletes / var / log / test directory and all its files, folders,
 RM -rf / var / log / test

Reference material

https://www.cnblogs.com/tirmer/p/8616362.html
https://blog.csdn.net/shuaigexiaobo/article/details/75053056

Guess you like

Origin www.cnblogs.com/jinzesudawei/p/12005709.html