Objective:

To find the files which are older than X days in Linux Operating system. In this scenario, X is represented in hours. If you wish to delete the files older than 2 days, then X value should be 48.

Process:

Step 1: SSH to the server.

Step 2: Identify the target directory. eg: /u01/wiki/temp/

Step 3: Use following command to delete the files older than 2 days.

Syntax:

Example:

Note:

tmpwatch – removes files which haven’t been accessed for a period of time