Your Question: How Do I Delete Old Files in Linux?
Contents

How do I delete 2 days old files in Linux?

Explanation

  1. The first argument is the path to the files. This can be a path, a directory, or a wildcard as in the example above. …
  2. The second argument, -mtime, is used to specify the number of days old that the file is. …
  3. The third argument, -exec, allows you to pass in a command such as rm.

How do I delete old files in UNIX?

If you want to delete files older than 1 day, you can try using -mtime +0 or -mtime 1 or -mmin $((60*24)) .

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest