Search recursively below data.
Display only regular files larger than 10 MiB using GNU find.
Which command is appropriate?
In find, a leading + on -size means greater than the specified amount. With GNU find, M represents a 1,048,576-byte unit.
Detailed explanation
find data -type f -size +10MCorrect. It recursively selects regular files whose size is greater than 10 MiB.
Correct. It recursively selects regular files whose size is greater than 10 MiB.
find data -type d -size +10MIncorrect. -type d selects directories, not regular files.
Incorrect. -type d selects directories, not regular files.
find data -type f -size 10MIncorrect. Without + it matches exactly 10 MiB units rather than larger files.
Incorrect. Without + it matches exactly 10 MiB units rather than larger files.
find data -type f -size -10MIncorrect. -10M selects files smaller than 10 MiB.
Incorrect. -10M selects files smaller than 10 MiB.
Try it yourself
An example you can run in a temporary verification environment.
LAB_DIR=$(mktemp -d)
truncate -s 11M "$LAB_DIR/large.bin"
truncate -s 1M "$LAB_DIR/small.bin"
find "$LAB_DIR" -type f -size +10M -printf '%f
'
rm -r "$LAB_DIR"Expected result
large.binKey points
- -type f selects regular files
- +N means greater than N
- M is a MiB-sized unit
Notes
- Environment: GNU findutils 4.x
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.