Find shell command

From Notes_Wiki
Revision as of 12:06, 14 January 2020 by Saurabh (talk | contribs) (Created page with "<yambe:breadcrumb>Shell_scripting|Shell scripting</yambe:breadcrumb> =find shell command= ==Find files older than given no. of days== To find files older than 30 days use: <...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

<yambe:breadcrumb>Shell_scripting|Shell scripting</yambe:breadcrumb>

find shell command

Find files older than given no. of days

To find files older than 30 days use:

find . -mtime +30 -daystart

Careful To automatically delete files older than 30 days use:

find . -mtime +30 -daystart -delete

To find files modified within last 5-6 days use:

find . -mtime +5 -mtime -6

There is also atime and ctime for access times and change times respectively. mtime used in above examples is for modification times.