How can I find all the files in directory greater than a certain size, say, 15 KB, and which have been modified in the last 10 days?
I'd do it like this:
find /directory -mtime -10 -size +15k
/directory is the base directory where the search is preformed (recursively by default).
-mtime 10 means it will look for files modified in the last 10 days:
-mtime n File's data was last modified n*24 hours ago. See the comments for -atime to understand how rounding affects the interpretation of file modi- fication times.
-size 15k means it will look for files larger than 15 kilobytes:
-size n[cwbkMG] File uses n units of space, rounding up. The following suffixes can be used: `b' for 512-byte blocks (this is the default if no suffix is used) `c' for bytes `w' for two-byte words `k' for Kilobytes (units of 1024 bytes) `M' for Megabytes (units of 1048576 bytes) `G' for Gigabytes (units of 1073741824 bytes) The size does not count indirect blocks, but it does count blocks in sparse files that are not actually allocated. Bear in mind that the `%k' and `%b' format specifiers of -printf handle sparse files differently. The `b' suffix always denotes 512-byte blocks and never 1 Kilobyte blocks, which is different to the behaviour of -ls. The + and - prefixes signify greater than and less than, as usual, but bear in mind that the size is rounded up to the next unit (so a 1-byte file is not matched by -size -1M).
If this is a homework question of some kind, please read the
find(1) manual for your operating system by typing
man find on your system, and really learn how it's working.
Since I know it's difficult for a neophyte to find out which Linux command can be used to obtain a specific result, I'll point you to the correct direction.
The command you need to use is
Its manual page, which you can read via
will give you all the info you need. From this point you can work alone.