How To Delete Old 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. Find and select the files you want to delete:
• Using the command line: Use the ‘find‘ command to locate and list the files you want to delete. For example, you can use find /path/to/files* –mtime +10 –exec rm {} ; to locate files older than 10 days in a specified directory and delete them.
• Using GUI file managers: Many modern Linux distributions offer a graphical file manager with the ability to filter and select files according to their attributes such as modification date.
2. Execute the delete command: After selecting the files that you want to delete, execute the ‘rm‘ command followed by the list of files. This will permanently delete all the files. For example, rm file1.txt file2.jpg file3.doc will delete the three files. If you want to delete all the files in the current directory, use rm *.*. Be careful when using this command as it cannot be undone.