After reading the article, I suddenly thought of the method of deleting all the files in the directory in Linux; I sorted out a few, if there are any shortcomings, I hope the readers will give me advice!
Delete files in the current directory
1.rm -f *
#The most classic way to delete all types of files in the current directory
2.find . -type f -delete或find . -type f -exec rm -f {} \;
#Use the find command to find ordinary files and delete or delete them with the processing action of the find command
3.find . -type f | xargs rm -f
#Used for parameter list is too long; too many files to delete
4.rm-f
find . -type f``
#Delete all ordinary files
5.for delete in
ls -l;do rm -f * ;done
#Use the for loop statement to delete all types of files in the current directory
Delete files in the specified directory
1.rm -f 指定目录*
#The most classic method, delete all types of files in the specified directory
2.find 指定目录 -type f -delete或find 指定目录 -type f -exec rm -f {} \;
#Use the find command to find all ordinary files in the specified directory and delete them or use the processing action of the find command to delete them
3.find 指定目录 -type f | xargs rm -f
#Used for parameter list is too long; too many files to delete
4.rm-f
find specifies the directory -type f''
#Delete all ordinary files in the specified directory
5.for delete in
ls -l specifies the directory path;do rm -f * ;done
#Use the for loop statement to delete all types of files in the specified directory
Linux commands to delete folders and files
to sum up
The above is a summary of the 10 methods for deleting files in Linux directories introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message, and the editor will reply to you in time. Thank you very much for your support to the Scripthome website!
The above is the Linux-related knowledge shared by Liangxu Tutorial Network for all friends.