How To Delete Files In Linux?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1. Use the rm command – To delete a single file, use the rm command followed by the file name:
$ rm filename
2. Use the rm command with the -r flag – To delete a directory and all its contents, use the rm command followed by the -r flag and the directory name:
$ rm -r dirname
3. Use the find command – To delete all files with a given name in a directory tree, use the find command followed by the -delete flag and the file name:
$ find . -name filename -delete